admin管理员组

文章数量:1125049

There was a problem that I had not encountered before, in our project in some places it is necessary to hide the tabbar, while the development was in progress we did not experience any problems, since we tested on iOS 16 and 17. To hide the tabbar we used the standard modifier .toolbar (.hidden, format: .tabbar). On iOS 16 and 17 there is no problem, everything works correctly, but in the case of iOS 18 it simply does not hide, it hides correctly only if you install the modifier in the root view, for example:

For iOS 16 and 17:

struct SomeView: View {
VStack {
Text("123")
   .toolbar(.hidden, for: .tabbar)
}
}

It worked, but dont work on iOS 18, i tried to use new API method in same place (.toolBarVisibility(.hidden, for: .tabbar)) - but it dont work.

Then I try to use this modifier in Root View in my tabbar:

struct TabBar: View {
   var supportView: some View {
      NavigationStack(path: $coordinator.path) {
         SupportView()
// for example here - .toolbarVisibility(.hidden, for: .tabBar) - it 
//  work, but i need setup this in another screen of this flow 3 or 4 screen in 
// hierarchy
            .navigationDestination(...) { screen in
                coordinator.buildProfileScreen(screen)
                    .navigationBarBackButtonHidden()
            }
      }
   }
}

this will work for supportview but i need tabbar hiding to work on 3rd screen in flow support

本文标签: swiftSwiftUI Tabbar not hiding on iOS 18Stack Overflow