Using XCode 12 Beta and iOS 14, I'm unable to hide the status bar when a NavigationView is nested inside a TabView. Consider:
The above code only hides the status bar if you remove the parent TabView. I also tried to hide the status bar onAppear:
This also doesn't work. I've also tried hiding the status bar directly on the TabView. Any suggestions?
Code Block TabView(selection: $selection) { NavigationView { ViewOne() .navigationBarTitle("View One") } .tabItem { Label("View One", systemImage: "doc.plaintext") } .tag(TabItem.viewOne) .statusBar(hidden: true) }
The above code only hides the status bar if you remove the parent TabView. I also tried to hide the status bar onAppear:
Code Block TabView(selection: $selection) { NavigationView { ViewOne() .navigationBarTitle("View One") .onAppear { isStatusBarHidden = true } .onDisappear { isStatusBarHidden = false } } .tabItem { Label("View One", systemImage: "doc.plaintext") } .tag(TabItem.viewOne) .statusBar(hidden: isStatusBarHidden) }
This also doesn't work. I've also tried hiding the status bar directly on the TabView. Any suggestions?