TargetAction
open class TargetAction
The TargetAction class bridges the gap between Swift closures and the common
Cocoa target (id)/action (SEL) paradigm. Construct a TargetAction with
a no-argument or single-argument callback closure. Then, use the target and
action properties of the TargetAction instance as you would normally
anywhere Cocoa calls for a target/action.
-
The object to use as the target of a target/action pair.
Declaration
Swift
open var target: Any -
The
Selectorto use as the action of the target/action pair.Declaration
Swift
open var action: Selector -
Constructs a
TargetActionwith a no-argument callback.Declaration
Swift
public init(callback: @escaping () -> Void)Parameters
callbackA callback closure that will be executed when the target/action pair represented by the newly-constructed instance is invoked.
-
Constructs a
TargetActionwith a single-argument callback.Declaration
Swift
public init(callback: @escaping (Any?) -> Void)Parameters
callbackA callback closure that will be executed when the target/action pair represented by the newly-constructed instance is invoked. The
Any?argument passed tocallbackwill be the argument sent toactionwhen invoked.
View on GitHub
TargetAction Class Reference