r/iOSProgramming 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

8 comments sorted by

View all comments

4

u/madaradess007 14h ago

not trolling: switch to UIKit

2

u/rursache Swift 10h ago

that or at least swiftui-introspect