UIControl

extension UIControl
  • Initialize a UIControl, using the given closure as the .TouchUpInside target/action event.

    Declaration

    Swift

    public convenience init(actionClosure: @escaping () -> Void)

    Parameters

    action

    The closure to execute upon control press.

    Return Value

    An initialized UIControl.

  • Initialize a UIControl with the given frame, using the given closure as the .TouchUpInside target/action event.

    Declaration

    Swift

    public convenience init(frame: CGRect, actionClosure: @escaping () -> Void)

    Parameters

    frame

    The frame of the control.

    action

    the closure to execute upon control press.

    Return Value

    An initialized UIControl.

  • Adds the given closure as the control’s target action

    Declaration

    Swift

    public func addTarget(for controlEvents: UIControl.Event, actionClosure: @escaping () -> Void)

    Parameters

    controlEvents

    The UIControlEvents upon which to execute this action.

    action

    The action closure to execute.