Composability of Workflows with SwiftUI Views #91
Unanswered
Curtis-Halbrook
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been puzzling over this issue for a few hours, and I'm at a loss as to how to move forward.
Given the situation that I've created a very simple Workflow driving the functionality of a Search Bar, I would now like to use this Search Bar as part of another larger view with its own Workflow. I don't seem to see any way to tie the behavior of the Search Bar to the owning Workflow.
Here's the Search Bar's code with some SwiftUI cut out:
Here's the SearchBarWorkflow, pared down to just the render method
You can likely figure out the Action and the State just from this little bit.
Now, I would like to use this View in a parent View, something along the lines of
but my issue in the DefinitionLookupWorkflow is that I don't seem to have any means of mapping the SearchBarWorkflow.Output to DefinitionLookupWorkflow.Action. I don't see how I can pass state and behavior to the nested SearchBar, since "mapOutput" returns an AnyWorkflow<SearchBarScreen, DefinitionLookupWorkflowAction>, and I can't pass that into the SearchBar since it is looking for a SearchBarWorkflow.
Any thoughts here?
Beta Was this translation helpful? Give feedback.
All reactions