How To represent the following flow #895
Unanswered
ibrahimkteish
asked this question in
Q&A
Replies: 1 comment
-
This is how I would model it: enum SubFlow: Equatable {
case flowB(FlowBState)
case flowC(FlowCState)
}
struct FlowState: Equatable {
var flowA: FlowAState
var subFlow: SubFlow?
}
let flowReducer = Reducer<FlowState, FlowAction, FlowEnvironment>.combine(
flowAReducer.pullback(\.flowA, /FlowAction.flowA, \.flowA),
flowBReducer
.pullback(/SubFlow.flowB, \.self, \.self)
.pullback(\.subFlow, /FlowAction.flowB, \.flowB),
flowCReducer
.pullback(/SubFlow.flowC, \.self, \.self)
.pullback(\.subFlow, /FlowAction.flowC, \.flowC),
Reducer { state, action, environment in
...
}
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello All,
In my project I start using a back-port (iOS 10+) version of the composable architecture, I have a question on how to design the following flow.
Flow B
andC
are mutual exclusive so for them I represented the state as Enumevery thing working as expected. Now I want to continue refactoring the code to create a flow reducer for all 3 flows. The question is should
FlowA
be another case in myenum
or astruct
holding a optional property of typeSubFlow
as the followingI would appreciate if someone can help me design this in the best way.
Beta Was this translation helpful? Give feedback.
All reactions