ObjectTarget

public class ObjectTarget<T:UIControl>:NSObject

A class for handling UIControl.addTarget(_:action:forControlEvents:) in a pure swift class.

  • The control which will trigger the completion on the given control events.

    Declaration

    Swift

    public let control:UIControl
  • The completion box that will run for the given control events.

    Declaration

    Swift

    public let completion:(sender:T) -> ()
  • Default initialiser.

    Declaration

    Swift

    public init(control:T, forControlEvents:UIControlEvents, completion:(sender:T) -> ())

    Parameters

    control

    The UIControl on which events will trigger the completion block.

    forControlEvents

    The UIControlEvents sent by control that will trigger completion.

    completion

    The code that will run when control sends forControlEvents.

  • The function that is called from UIControl.addTarget(_:action:forControlEvents:).

    Declaration

    Swift

    public func targetted(sender:AnyObject?)