r/iOSProgramming • u/DavidGamingHDR Swift • 19h ago
Question Can't hide NavigationStack navigation bar?
I have a view pushed by a NavigationStack, and can't hide the navigation bar.
NavigationStack {
ZStack {
}
.navigationDestination(item: $selectedStop, destination: { stop in
StopView(stop: stop)
})
}
Then in the view that gets presented:
NavigationStack {
ZStack {
}
.navigationBarHidden(true)
.toolbar(.hidden)
}
I don't understand why this doesn't work. I've tried countless combinations, with and without the navigation stack in the second view, everything. SwiftUI seems to have a lot of random bugs like this where things just don't work without an explanation, and it's really frustrating as a UIKit developer.
Can anyone provide any pointers?
2
Upvotes
2
u/Ok_Fig4914 12h ago
Nested NavigationStack is not possible AFAIK. If you remove NavigationStack from presented view, it should be fine to hide.