Functions

The following functions are available globally.

  • Undocumented

    Declaration

    Swift

    public func |><A, B>(x: A, f: (A) -> B) -> B
  • Undocumented

    Declaration

    Swift

    public func >>> <A, B, C>(f: @escaping (A) -> B, g: @escaping (B) -> C) -> (A) -> C
  • Undocumented

    Declaration

    Swift

    public func <> <A>(f: @escaping (A) -> A, g: @escaping (A) -> A) -> (A) -> A
  • Compose two functions from one type to Void. functions will be applied in order internally.

    Declaration

    Swift

    public func <> <A: AnyObject>(f: @escaping (A) -> Void, g: @escaping (A) -> Void) -> (A) -> Void

    Parameters

    f

    first function

    g

    second function

  • Compose two functions from one type (inout) to Void. functions will be applied in order internally.

    Declaration

    Swift

    public func <> <A>(f: @escaping (inout A) -> Void, g: @escaping (inout A) -> Void) -> (inout A) -> Void

    Parameters

    f

    first function

    g

    second function

  • Style border of view

    Declaration

    Swift

    public func border(color: UIColor, width: CGFloat) -> (UIView) -> Void

    Parameters

    color

    border color

    width

    width of border

    Return Value

    Styling function

  • Style corner of a view

    Declaration

    Swift

    public func corner(radius: CGFloat) -> (UIView) -> Void

    Parameters

    radius

    radius of corner

  • Style background of view

    Declaration

    Swift

    public func background(color: UIColor) -> (UIView) -> Void

    Parameters

    color

    background color of view

    Return Value

    Styling function

  • Creates a controller that represents a specific device, orientation with specific traits.

    Declaration

    Swift

    public func playgroundWrapper(child: UIViewController,
                                  device: Device = .phone4_7inch,
                                  orientation: Orientation = .portrait,
                                  contentSizeCategory: UIContentSizeCategory = .large,
                                  additionalTraits: UITraitCollection = .init())
        -> UIViewController

    Parameters

    device

    The device the controller should represent.

    orientation

    The orientation of the device.

    child

    An optional controller to put inside the parent controller. If omitted a blank controller will be used.

    additionalTraits

    An optional set of traits that will also be applied. Traits in this collection will trump any traits derived from the device/orientation comboe specified.

    Return Value

    Two controllers: a root controller that can be set to the playground’s live view, and a content controller which should have UI elements added to it