ActionSequenceConfiguration

@MainActor
public struct ActionSequenceConfiguration<InteractorType, ContentType> : InteractorConfiguring, ActionCollectionConfiguring where InteractorType : InteractorTypeable, ContentType : ContentTypeable

A configuration object that defines an ordered sequence of actions to be executed by an ActionSequence.

Sequence steps are added using step(_:inputTransformer:). Each call automatically wires an output conduit from the previously added step to the new one; the optional inputTransformer converts the previous step’s output before this new step receives it.

let config = ActionSequenceConfiguration<MyInteractor, MyContent>()
    .step(stepA)
    .step(stepB, inputTransformer: myTransformer)

Note

ActionSequenceConfiguration is value-typed; each chained call returns a modified copy.

Parameters

InteractorType

The interactor type used to perform each action, constrained to InteractorTypeable.

ContentType

The content type passed between steps, constrained to ContentTypeable.

  • A sequence has no single action type of its own; this placeholder satisfies the ActionConfiguring requirement. Each child carries its own real action type.

    See more

    Declaration

    Swift

    public enum SequenceActionType : InteractorRequestActionTypeable
  • Undocumented

    Declaration

    Swift

    public typealias ActionType = SequenceActionType
  • Declaration

    Swift

    @MainActor
    public let interactorType: InteractorType?
  • Declaration

    Swift

    @MainActor
    public let actionType: SequenceActionType
  • Unused. A sequence has no single assistant. Each child builds its own.

    Declaration

    Swift

    @MainActor
    public let assistant: InteractorAssistantType
  • Declaration

    Swift

    @MainActor
    public var outputConduit: (any ActionSequenceConduiting<ContentType>)?
  • An optional identifier of this sequence, carried onto the group’s ActionResult.

    Declaration

    Swift

    @MainActor
    public let identifier: (any ActionIdentifying)?
  • Declaration

    Swift

    @MainActor
    public let shouldEndParentTaskOnFailure: Bool
  • Declaration

    Swift

    @MainActor
    public let shouldSaveResult: Bool
  • Declaration

    Swift

    @MainActor
    public let configurationType: ActionConfigurationType
  • Declaration

    Swift

    @MainActor
    public var merger: (any ActionResultsMerging<ContentType>)?
  • Unused. A sequence has no children to save the results of.

    Declaration

    Swift

    @MainActor
    public let shouldSaveChildResults: Bool
  • An array of action configurations which the group should run in sequence. The sequence is determined by the array order.

    Declaration

    Swift

    @MainActor
    public var actions: [any ActionConfiguring<InteractorType, ContentType>]
  • Undocumented

    Declaration

    Swift

    @MainActor
    public init(outputConduit: (any ActionSequenceConduiting<ContentType>)? = nil, identifier: (any ActionIdentifying)? = nil, shouldEndParentTaskOnFailure: Bool? = nil, shouldSaveResult: Bool? = nil)
  • Adds a step representing an ActionPerformable object to the end of the sequence.

    If a previous step exists and doesn’t already have an output conduit assigned (via a preceding, deprecated output(using:) call), this automatically attaches one, connecting that previous step’s output to this new step.

    Declaration

    Swift

    @MainActor
    public func step(_ step: any ActionConfiguring<InteractorType, ContentType>, inputTransformer: (any ContentTransformable<ContentType, ContentType>)? = nil) -> ActionSequenceConfiguration<InteractorType, ContentType>

    Parameters

    step

    A configuration object for the action this step should perform.

    inputTransformer

    An optional transformer that converts the previous step’s output before this new step receives it. The transformer is unused when this is the first step added, as there would be no previous step to transform from.

    Return Value

    A copy of this configuration with the step appended, allowing calls to be chained.

  • Associates an output conduit with the most recently added step.

    Throws

    missingAction if no steps have been added yet.

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated and will be removed in a future version. To migrate, instead pass a transformer directly to `step(_:inputTransformer:﹚` instead.")
    @MainActor
    public func output(using transformer: (any ContentTransformable<ContentType, ContentType>)? = nil) throws -> ActionSequenceConfiguration<InteractorType, ContentType>

    Parameters

    conduit

    The conduit that will carry output from the current step to the next.

    Return Value

    A copy of this configuration with the conduit assigned to the last step, allowing calls to be chained.

  • Declaration

    Swift

    @MainActor
    public func buildAssistant() throws -> any AsyncInteractorAssisting<InteractorType, ContentType>
  • Declaration

    Swift

    @MainActor
    public func buildAction(resultHandler: any InteractorResultHandling<InteractorType, ContentType>) throws -> any ActionPerformable<ContentType>