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.
  • The feature to which the action is bounc

    Declaration

    Swift

    public let feature: FeatureType.Type
  • The action bound to the feature

    Declaration

    Swift

    public let action: ActionType.Type
  • The TopicPath to use when outputting logging for this action

    Declaration

    Swift

    public var logTopicPath: TopicPath { get }
  • 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(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(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.

  • param url: If specified, will be assumed to be a URL from a URLMapped feature that maps to invoke the action.
  • Note

    You do not need to use this normally if you use ActivityActionDispatchObserver which will publish activities automatically.

    Declaration

    Swift

    public func activity(for input: ActionType.InputType, withURL url: URL?) -> NSUserActivity?