Action
@MainActor
public final class Action<InteractorType, ContentType> : ActionPerformable where InteractorType : InteractorTypeable, ContentType : ContentTypeable
This object represents a single action in an ActionPerformableCollection object. The actual work done is handled by an Interactor; this object calls asyncRequestForAction(destination:actionType:content:resultTransformer:) on its assistant, and upon completion adds its result to a results array it passes along to this step’s output conduit. If there is no conduit attached, it will assume the sequence is completed and return all results. If the action’s task is cancelled an cancelled(partialResults:) error will be returned; if the interactor returns a failure an ActionError/failed(partialResults:) error will be returned, both with the accumulated results that completed previously in the sequence.
Note
Generally you should not create this object directly. Instead, ActionConfiguration objects should be used to represent sequence steps in conjunction with an ActionSequenceConfiguration object.
-
Declaration
Swift
@MainActor public let id: UUID -
Declaration
Swift
@MainActor public let actionType: (any InteractorRequestActionTypeable)? -
Declaration
Swift
@MainActor public let identifier: (any ActionIdentifying)? -
Declaration
Swift
@MainActor public var outputConduit: (any ActionSequenceConduiting<ContentType>)? -
Declaration
Swift
@MainActor public let shouldEndParentTaskOnFailure: Bool -
Declaration
Swift
@MainActor public let shouldSaveResult: Bool -
init(actionType:identifier: assistant: resultHandler: outputConduit: shouldEndParentTaskOnFailure: shouldSaveResult: resultTransformer: ) Undocumented
Declaration
Swift
@MainActor public init(actionType: any InteractorRequestActionTypeable, identifier: (any ActionIdentifying)? = nil, assistant: any AsyncInteractorAssisting<InteractorType, ContentType>, resultHandler: any InteractorResultHandling<InteractorType, ContentType>, outputConduit: (any ActionSequenceConduiting<ContentType>)?, shouldEndParentTaskOnFailure: Bool = false, shouldSaveResult: Bool = true, resultTransformer: ContentTransformerWrapper<ContentType>? = nil) -
perform(with:AsynchronoussequenceOutputs: ) Declaration
Swift
@MainActor public func perform(with content: ContentType?, sequenceOutputs: ActionCollectionResults<ContentType>) async -> Result<ActionCollectionResults<ContentType>, any Error>
View on GitHub