I see tons of examples of implementing NavigationStack
with TCA, but all I see is that we're managing pushing the screens' logic at one place, i.e., the root Reducer.
I feel like I'm missing something here.
For instance, I have one HomeView
that has two buttons, Login
and Signup
If I tap Signup
, it's supposed to push 5 more screens, starting with
- Email OTP
- Name and Last Name
- Gender
- etc...
Where do I manage this state.stack.append()
logic?
So far, I am only able to do so inside my HomeFeature
, since it's the HomeView
, where I've set up my NavigationStack
, which means my destination
will be filled with tons of Views.
struct HomeView: View {
@Bindable var store: StoreOf<HomeFeature>
var body: some View {
NavigationStack(path: $store.scope(
state: \.stackState,
action: \.stackAction
)) {
HomeViewBody(store)
} destination: { state in
switch state.case {
case .loginEmailAddressPath(let store):
LoginEmailAddressView(store: store)
case .loginOtpPath(let store):
LoginEmailOTPView(store: store)
case .signupPath(let store):
SignupView(store: store)
case .signupNameInfo(let store):
NameInfoView(store: store)
case .signupDOBInfo(let store):
DOBInfoView(store: store)
case .signupSexInfo(let store):
SexInfoView(store: store)
case .signupSkinTypeInfo(let store):
SkinTypeInfoView(store: store)
case .signupBodyInfo(let store):
BodyInfoView(store: store)
}
}
}
}
Can anyone please guide me to proper resources?
Thanks!