Skip to content

EXTENSION

AnyWorkflowConvertible

extension AnyWorkflowConvertible

Methods

mapOutput(_:)

public func mapOutput<NewOutput>(_ transform: @escaping (Output) -> NewOutput) -> AnyWorkflow<Rendering, NewOutput>

mapRendering(_:)

public func mapRendering<NewRendering>(_ transform: @escaping (Rendering) -> NewRendering) -> AnyWorkflow<NewRendering, Output>

rendered(in:key:)

public func rendered<Parent>(in context: RenderContext<Parent>, key: String = "") -> Rendering where Output: WorkflowAction, Output.WorkflowType == Parent

Creates or updates a child workflow of the given type, performs a render pass, and returns the result.

Note that it is a programmer error to render two instances of a given workflow type with the same key during the same render pass.

  • Parameter context: The context with which the workflow will be rendered.
  • Parameter key: A string that uniquely identifies this workflow.

  • Returns: The Rendering generated by the workflow.

Parameters

Name Description
context The context with which the workflow will be rendered.
key A string that uniquely identifies this workflow.

rendered(in:key:outputMap:)

public func rendered<Parent, Action>(in context: RenderContext<Parent>, key: String = "", outputMap: @escaping (Output) -> Action) -> Rendering where Action: WorkflowAction, Action.WorkflowType == Parent

rendered(in:key:)

public func rendered<Parent>(in context: RenderContext<Parent>, key: String = "") -> Rendering where Output == AnyWorkflowAction<Parent>

rendered(in:key:)

public func rendered<T>(in context: RenderContext<T>, key: String = "") -> Rendering

Creates or updates a child workflow of the given type, performs a render pass, and returns the result.

Note that it is a programmer error to render two instances of a given workflow type with the same key during the same render pass.

  • Parameter context: The context with which the workflow will be rendered.
  • Parameter key: A string that uniquely identifies this workflow.

  • Returns: The Rendering generated by the workflow.

Parameters

Name Description
context The context with which the workflow will be rendered.
key A string that uniquely identifies this workflow.

running(in:key:outputMap:)

public func running<Parent, Action>(in context: RenderContext<Parent>, key: String = "", outputMap: @escaping (Output) -> Action) where Action: WorkflowAction, Action.WorkflowType == Parent

running(in:key:)

public func running<Parent>(in context: RenderContext<Parent>, key: String = "") where Output.WorkflowType == Parent

onOutput(_:)

public func onOutput<Parent>(_ apply: @escaping ((inout Parent.State, Output) -> Parent.Output?)) -> AnyWorkflow<Rendering, AnyWorkflowAction<Parent>>

Process an Output

  • Parameter apply: On Output, mutate State as necessary and return new Output (or nil).

Parameters

Name Description
apply On Output, mutate State as necessary and return new Output (or nil).

ignoringOutput()

public func ignoringOutput() -> AnyWorkflow<Rendering, Never>

Wraps this workflow in a workflow that ignores all outputs.

  • Returns: An AnyWorkflow with the same rendering and no output.