From b55f956ff8830b5b3b6f73056fbd011b51a7739b Mon Sep 17 00:00:00 2001 From: Matthew Faluotico Date: Thu, 20 Aug 2020 13:19:49 -0700 Subject: [PATCH] Introduce 'makeOutputSink' convenience on 'RenderContext' --- Workflow/Sources/RenderContext.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Workflow/Sources/RenderContext.swift b/Workflow/Sources/RenderContext.swift index b4f2a4aa6..8f7695974 100644 --- a/Workflow/Sources/RenderContext.swift +++ b/Workflow/Sources/RenderContext.swift @@ -148,4 +148,11 @@ extension RenderContext { } } } + + /// Generates a sink that allows sending the Workflow's output wrapped in an AnyWorkflowAction, allowing bypassing an + /// intermediate action. + public func makeOutputSink() -> Sink { + return makeSink(of: AnyWorkflowAction.self) + .contraMap { AnyWorkflowAction(sendingOutput: $0) } + } }