This sounds like another bug around SwiftUI navigation. Previously:
I'm not sure if this is related to this SwiftUI bug , but I haven't been able to fix it with the advice in that link.
For some reason, when pressing the back button (or swiping) in a navigation stack the setter in the binding gets called twice, which means the setNavigation(nil) action is sent twice.
This happens for every example in the repo. It's usually not a big deal, but if you are doing something in the reducer when the navigation goes back it could be problematic.
The way I fixed it is …
Hi @Viranchee !
Do you plan on driving navigation from state programmatically? E.g. deep-linking? If not, you should be able to use the bindingless NavigationLink APIs and let SwiftUI handle it for you:
NavigationLink(
destination: Text(viewStore.value.givenName)
) {
EmptyView() // label here
}
If you do want to drive navigation with state programmatically, it's a little trickier. We have a couple examples of lists of navigation links in the demos that ship with the repo (example 1 , exampl…
I'd suggest trying to reproduce this behavior outside the Composable Architecture (see the last link for a Binding helper that aids in debugging) and filing Feedback if you can!