Skip to content

EXTENSION

AnyWorkflow

extension AnyWorkflow: Workflow

Methods

render(state:context:)

public func render(state: Void, context: RenderContext<AnyWorkflow<Rendering, Output>>) -> Rendering

Parameters

Name Description
state The current state.
context The workflow context is the composition point for the workflow tree. To use a nested workflow, instantiate it based on the current state, then call rendered(in:key:outputMap:). This will return the child’s Rendering type after creating or updating the nested workflow.

asAnyWorkflow()

public func asAnyWorkflow() -> AnyWorkflow<Rendering, Output>

mapOutput(_:)

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

Returns a new AnyWorkflow whose Output type has been transformed into the given type.

  • Parameter transform: An escaping closure that maps the original output type into the new output type.

  • Returns: A type erased workflow with the new output type (the rendering type remains unchanged).

Parameters

Name Description
transform An escaping closure that maps the original output type into the new output type.

mapRendering(_:)

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

Returns a new AnyWorkflow whose Rendering type has been transformed into the given type.

  • Parameter transform: An escaping closure that maps the original rendering type into the new rendering type.

  • Returns: A type erased workflow with the new rendering type (the output type remains unchanged).

Parameters

Name Description
transform An escaping closure that maps the original rendering type into the new rendering type.