diff --git a/swift/Workflow/Sources/WorkflowHost.swift b/swift/Workflow/Sources/WorkflowHost.swift index 0924068af..62d08aad3 100644 --- a/swift/Workflow/Sources/WorkflowHost.swift +++ b/swift/Workflow/Sources/WorkflowHost.swift @@ -53,6 +53,20 @@ public final class WorkflowHost { } + /// Update the input for the workflow. Will cause a render pass. + public func update(workflow: WorkflowType) { + rootNode.update(workflow: workflow) + + // Treat the update as an "output" from the workflow to force a render pass and update the debug info. + let output = WorkflowNode.Output( + outputEvent: nil, + // TODO FIXME HAX HAX HAX: Better debug info generation, specifically the "type". + debugInfo: WorkflowUpdateDebugInfo( + workflowType: "\(WorkflowType.self)", + kind: .didUpdate(source: .external))) + handle(output: output) + } + private func handle(output: WorkflowNode.Output) { mutableRendering.value = rootNode.render()