StaticActionBinding
public struct StaticActionBinding<FeatureType, ActionType> : CustomDebugStringConvertible where FeatureType : FeatureDefinition, ActionType : Action
Represents the binding of an action to a specific unconditional Feature
.
These are use as the main entry point for performing actions, having been bound using the action
function
of Feature
(provided by a protocol extension).
class DocumentManagementFeature: Feature {
static let description = "Create documents"
// This is where the binding is created
static let createNew = action(DocumentCreateAction.self)
static func prepare(actions: FeatureActionsBuilder) {
actions.declare(createNew)
}
}
... later you can perform the action directly ...
DocumentManagementFeature.createNew.perform( ... )
Note that you do not create these bindings explicitly, you must use the Flint `action` function for this.
-
Declaration
Swift
public var debugDescription: String { get }
-
A convenience function to perform the action in the main
ActionSession
.This function performs the action assuming the user initiated the action, and the application was the source of the request.
The completion handler is called on main queue because the action is performed in the main
ActionSession
- param presenter: The object presenting the outcome of the action
- param input: The value to pass as the input of the action
- param completion: The completion handler to call.
Declaration
Swift
public func perform(withInput input: ActionType.InputType, presenter: ActionType.PresenterType, completion: ((ActionOutcome) -> ())? = nil)
-
A convenience function to perform the action in the main
ActionSession
The completion handler is called on main queue because the action is performed in the main
ActionSession
- param presenter: The object presenting the outcome of the action
- param input: The value to pass as the input of the action
- param userInitiated: Set to
true
if the user explicitly chose to perform this action,false
if not - param source: Indicates where the request came from
- param completion: The completion handler to call.
Declaration
Swift
public func perform(withInput input: ActionType.InputType, presenter: ActionType.PresenterType, userInitiated: Bool, source: ActionSource, completion: ((ActionOutcome) -> ())? = nil)
-
Convenience function for creating an activity for this action with a given input.
This function can throw if the
prepareActivity
function on the action cannot return an activity for the give input.- param url: If specified, will be assumed to be a URL from a URLMapped feature that maps to invoke the action, for continuity
return: The activity that represents this action with the given input, or nil if there is no valid activity to represent it.
Note
You do not need to use this normally if you use
ActivityActionDispatchObserver
which will publish activities automatically.Declaration
Swift
public func activity(withInput input: ActionType.InputType, withURL url: URL?) throws -> NSUserActivity?
-
Undocumented
Declaration
Swift
public func perform(withInput input: ActionType.InputType, completion: ((ActionOutcome) -> ())? = nil)
-
Undocumented
Declaration
Swift
public func perform(withInput input: ActionType.InputType, userInitiated: Bool, source: ActionSource, completion: ((ActionOutcome) -> ())? = nil)
-
Undocumented
Declaration
Swift
public func perform(withPresenter presenter: ActionType.PresenterType, completion: ((ActionOutcome) -> ())? = nil)
-
Undocumented
Declaration
Swift
public func perform(withPresenter presenter: ActionType.PresenterType, userInitiated: Bool, source: ActionSource, completion: ((ActionOutcome) -> ())? = nil)
-
Undocumented
Declaration
Swift
public func perform(withCompletion completion: ((ActionOutcome) -> ())? = nil)
-
Undocumented
Declaration
Swift
public func perform(userInitiated: Bool, source: ActionSource, completion: ((ActionOutcome) -> ())? = nil)