When implementing the Tree-Based navigation style, it is possible to send actions to a child reducer from the parent reducer.
For context, here is an example of the code i'm using:
And I'm using TCA 0.57.0 right now
extension ChildOne {
enum Action {
case updateStateWhenViewAppear
}
}
extension ParentReducer {
struct Destination: Reducer {
enum State {
case childOne(ChildOne.State)
case childTwo(ChildTwo.State)
}
enum Action {
case childOne(ChildOne.Action)
case childTwo(ChildTwo.Action)
}
var body: some ReducerOf<Self> { ... }
}
}
extension ParentReducer {
struct State {
@PresentationState var destination: ParentReducer.Destination
}
enum Action {
case destination(PresentationAction<ParentReducer.Action>)
}
}
And this is the code that I have to call an action from the cases from the Destination struct, but this doesn't work for me:
return ChildOne()
.reduce(into: &state.destination, action: .updateStateWhenViewAppear)
.map(Action.destination)
Is there is any suggestion for how to call a child action, from the parent reducer, using a Tree-Based navigation style?