STRUCT
AnyWorkflowAction¶
public struct AnyWorkflowAction<WorkflowType: Workflow>: WorkflowAction
A type-erased workflow action.
The AnyWorkflowAction type forwards apply to an underlying workflow action, hiding its specific underlying type.
Properties¶
base¶
public let base: Any
The underlying type-erased WorkflowAction
isClosureBased¶
public let isClosureBased: Bool
True iff the underlying apply implementation is defined by a closure vs wrapping a WorkflowAction conformance
Methods¶
init(_:)¶
public init<E>(_ base: E) where E: WorkflowAction, E.WorkflowType == WorkflowType
Creates a type-erased workflow action that wraps the given instance.
- Parameter base: A workflow action to wrap.
 
Parameters¶
| Name | Description | 
|---|---|
| base | A workflow action to wrap. | 
init(_:fileID:line:)¶
public init(
    _ apply: @escaping (inout WorkflowType.State) -> WorkflowType.Output?,
    fileID: StaticString = #fileID,
    line: UInt = #line
)
Creates a type-erased workflow action with the given apply implementation.
- Parameter apply: the apply function for the resulting action.
 
Parameters¶
| Name | Description | 
|---|---|
| apply | the apply function for the resulting action. | 
apply(toState:)¶
public func apply(toState state: inout WorkflowType.State) -> WorkflowType.Output?
Parameters¶
| Name | Description | 
|---|---|
| state | The current state of the workflow. The state is passed as an inout param, allowing actions to modify state during application. |