iOS 17.4 SwiftUI .toolbar(.hidden, for: .tabBar) not work

TabView {
            SummaryView()
                .toolbar(.hidden, for: .tabBar, .bottomBar)
                .tabItem { Text("Title.Summary") }
                .tag(TabItems.summary)
            CalendarView()
                .toolbar(.hidden, for: .tabBar, .bottomBar)
                .tabItem { Text("Title.Calendar") }
                .tag(TabItems.calendar)
            EventTypeView()
                .toolbar(.hidden, for: .tabBar, .bottomBar)
                .tabItem { Text("Title.EventType") }
                .tag(TabItems.group)
            LectureView()
                .toolbar(.hidden, for: .tabBar, .bottomBar)
                .tabItem { Text("Title.Lecture") }
                .tag(TabItems.lecture)
            NotificationView()
                .toolbar(.hidden, for: .tabBar, .bottomBar)
                .tabItem { Text("Title.Notifications") }
                .tag(TabItems.notification)
}

Tabbar is hidden when first opened but tabbar is appeared when I change tab selection. I tested it on iOS 17.1, iOS 17.4, and this bug is only appeared in iOS 17.4.

I've run into all sorts of problems with .toolbar/.tabBar in iOS 17.4 which suddenly stopped working right after over a year of unchanged code. In the end I came up with this convoluted code where I use a @Binding to control the .hidden/.visible state of the tab bar, and set the variable in various .onAppear/.onDisappear handlers.

Can you try .tabViewStyle(.page) on ios 17.4

Yes, it could be an alternative. I also tried that way and it works perfectly, I mean no visible tabBar. But I wanted not to apply a gesture to change views on tabView. I want it to work by only tapping on tabBar. So that way is not a perfect way if you don't want gestures on tabView. Or other way to prevent gestures?

Converting to .tabViewStyle(.page) also breaks inner Navigation Bars or at least Safe Area for me. It would require a severe rewrite of the whole app UI structure.

iOS 17.5 beta is out and no fix for this. How is it possible SwiftUI cannot be a reliable tool after this much time.

Ah really? It's still not fixed on iOS 17.5 Beta? Actually I didn't expect that Apple would fix quickly haha.. I guess at least we have to wait for iOS 18. Since iOS 14, SwiftUI looked nice and useful, so I strongly insisted converting to SwiftUI from UIKit on my company. I did and it took longer time than expected. But the result of strongly pushing is like that... The executives and team chief has lost expectations on SwiftUI, and even they think it's better to go back to UIKit. Very unreliable, SwiftUI is, I agree.

This is what I did for my tabs and no longer have the problem with system tabbar showing up unexpectedly.

    @State var activeTab: Screen = .home
    var body: some View {
        TabView(selection: $activeTab) {
            switch activeTab {
            case .home:
                HomeRoot()
                    .tag(Screen.home)
            case .menu:
                MenuRoot()
                    .tag(Screen.menu)
            case .rewards:
                RewardsRoot()
                    .tag(Screen.rewards)
            case .scan:
                Scan()
                    .tag(Screen.scan)
            default:
                EmptyView()
            }
        }
        .safeAreaInset(edge: .bottom) {
            TabBarView(
                activeTab: $activeTab
            )
        }
    }
iOS 17.4 SwiftUI .toolbar(.hidden, for: .tabBar) not work
 
 
Q