-
I recently followed the TCA navigation - https://pointfreeco.github.io/swift-composable-architecture/main/tutorials/composablearchitecture/02-01-yourfirstpresentation/ Here is the Destination reducer
and here is how the plus button tap is handled:
The ContactFeature has a tree base navigation with enums and presents a modal view AddContactView with
What do I need to do to convert this to a drill down navigation so that the AddContactView is pushed on the Contacts list instead of presenting it as a modal? I tried changing the
But when I run the app and tap the button nothing happens. The drill down navigation when i select an item on the list works but that uses a path with StackState generic on the state of the detail view. Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-07-14.at.15.11.18.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @tobitech, can you provide a full code example that demonstrates the bad behavior? Also, this snippet here is not correct: .navigationDestination(
store: self.store.scope(state: \.$destination, action: { .destination($0) }),
state: /ContactsFeature.Destination.State.addContact,
action: ContactsFeature.Destination.Action.addContact,
destination: { addContactStore in
NavigationStack {
AddContactView(store: addContactStore)
}
}
) This is trying to push a whole new There may be more things that need to change, but that is the only thing that stood out from the code you have provided so far. |
Beta Was this translation helpful? Give feedback.
Hi @tobitech, thank you for sharing the project. The problem is that you are applying
navigationDestination
on the outside ofNavigationStack
and so it does not see that state change and does not push the screen onto the stack. You need to move that view modifier inside the navigation stack's root view, like say on theList { … }
, and then it will work.This is how it works in vanilla SwiftUI too.