navigationBarHidden broken with SwiftUI Xcode beta?

Viewed 593

I'm trying out SwiftUI for an demo project and my navigationBarHidden fails on one computer while succeeding on another. They are both on the Xcode Beta.

It is a very simple transit app with a tab bar and navigation view as its root. The detail view has a custom header with floating buttons for backward navigation as well as a "more" menu. I want to hide the navigation bar to make this as visually appealing as possible, but right now I can't get the nav bar to disappear one one of my machines.

struct Dashboard: View {
    var body: some View {
        NavigationView {
            TabView {
                SavedStopsBrowser().tabItem {
                    Label(Verbiage.shared.saved, systemImage: "star")
                }
                StopSearcher().tabItem {
                    Label(Verbiage.shared.search, systemImage: "magnifyingglass")
                }
            }.accentColor(AppColors.primary)
        }
    }
}

The detail view of the saved stop is as such:

struct StopViewer: View {
    
    @Environment(\.presentationMode) var presentation
    let stop: TrainStop
    
    init(stop: TrainStop) {
        self.stop = stop
    }
    
    var body: some View {
        GeometryReader { geometry in
            ScrollView {
                VStack(spacing: 0) {
                    CollapseableStopHeader(stop: stop, geometry: geometry, backButtonAction: {
                        self.presentation.wrappedValue.dismiss()
                    }, moreButtonAction: {
                        print("User did press more button")
                    })
                    TransitLineCatalog(lines: stop.associatedTrainLines)
                        .padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 10))
                }
            }
            .navigationBarHidden(true)
            .ignoresSafeArea(edges: .top)
        }
    }
}

Any thoughts or suggestions as a way to make this work? Am I doing something horribly wrong?

0 Answers
Related