CocoaAction
public final class CocoaAction<Sender>: NSObject
CocoaAction wraps an Action
for use by a UI control (such as NSControl
or
UIControl
).
-
The selector for message senders.
Declaration
Swift
public static var selector: Selector
-
Whether the action is enabled.
This property will only change on the main thread.
Declaration
Swift
public let isEnabled: Property<Bool>
-
Whether the action is executing.
This property will only change on the main thread.
Declaration
Swift
public let isExecuting: Property<Bool>
-
Initialize a CocoaAction that invokes the given Action by mapping the sender to the input type of the Action.
Declaration
Swift
public init<Input, Output, Error>(_ action: Action<Input, Output, Error>, _ inputTransform: @escaping (Sender) -> Input)
Parameters
action
The Action.
inputTransform
A closure that maps Sender to the input type of the Action.
-
Initialize a CocoaAction that invokes the given Action.
Declaration
Swift
public convenience init<Output, Error>(_ action: Action<(), Output, Error>)
Parameters
action
The Action.
-
Initialize a CocoaAction that invokes the given Action with the given constant.
Declaration
Swift
public convenience init<Input, Output, Error>(_ action: Action<Input, Output, Error>, input: Input)
Parameters
action
The Action.
input
The constant value as the input to the action.
-
Attempt to execute the underlying action with the given input, subject to the behavior described by the initializer that was used.
Declaration
Swift
@IBAction public func execute(_ sender: Any)
Parameters
sender
The sender which initiates the attempt.