ActionProtocol
public protocol ActionProtocol
A protocol for Action
s for generic constraints and code reuse.
-
The type of the values output from the action.
Declaration
Swift
associatedtype Output
-
The type of the values used as inputs to the action.
Declaration
Swift
associatedtype Input
-
The type of errors emitted by the action.
Declaration
Swift
associatedtype Error : Error
-
The type of errors emitted when applying the action.
Declaration
Swift
associatedtype ApplyError : Error
-
Whether the action is currently executing.
Declaration
Swift
var isExecuting: Property<Bool> { get }
-
Whether the action is currently enabled.
Declaration
Swift
var isEnabled: Property<Bool> { get }
-
A signal of all values generated from all units of work of the
Action
.In other words, this sends every value from every unit of work that the
Action
executes.Declaration
Swift
var values: Signal<Output, NoError> { get }
-
A signal of all errors generated from all units of work of the
Action
.In other words, this sends every error from every unit of work that the
Action
executes.Declaration
Swift
var errors: Signal<Error, NoError> { get }
-
The lifetime of the
Action
.Declaration
Swift
var lifetime: Lifetime { get }
-
Create a
SignalProducer
that would attempt to create and start a unit of work of theAction
. TheSignalProducer
would forward only events generated by the unit of work it created.Declaration
Swift
func apply(_ input: Input) -> SignalProducer<Output, ApplyError>
Parameters
input
A value to be used to create the unit of work.
Return Value
A producer that forwards events generated by its started unit of work, or returns an appropriate
ApplyError
indicating the specific error that happened.
-
apply()
Extension methodCreate a
SignalProducer
that would attempt to create and start a unit of work of theAction
. TheSignalProducer
would forward only events generated by the unit of work it created.Declaration
Swift
public func apply() -> SignalProducer<Output, ApplyError>
Return Value
A producer that forwards events generated by its started unit of work, or returns an appropriate
ApplyError
indicating the specific error that happened.