Skip to content

EXTENSION

RenderContext

extension RenderContext

Methods

makeSink(of:onEvent:)

public func makeSink<Event>(of eventType: Event.Type, onEvent: @escaping (Event, inout WorkflowType.State) -> WorkflowType.Output?) -> Sink<Event>

makeOutputSink()

public func makeOutputSink() -> Sink<WorkflowType.Output>

Generates a sink that allows sending the Workflow’s output wrapped in an AnyWorkflowAction, allowing bypassing an intermediate action.

makeStateMutationSink()

public func makeStateMutationSink() -> StateMutationSink<WorkflowType>

Creates StateMutationSink.

To create a sink:

let stateMutationSink = context.makeStateMutationSink()

To mutate State on an event:

stateMutationSink.send(\State.value, value: 10)