iPadOS 18 TabView conflicts with NavigationSplitView

If you use the new TabView in conjunction with ".tabViewStyle(.sidebarAdaptable)" and have a NavigationSplitView in the tabs, the result is a very confusing user experience.

When the TabView is displayed as tabs, there are two sidebar buttons. The left one closes/opens the sidebar of the view of the selected tab.

The sidebar button of the Top-TabView closes/opens the sidebar for customizing the tabbar. However, this sidebar overlays the sidebar of the selected tab. To be able to use the underlying sidebar again, the user must actively close the TabView sidebar again (turn it into the top tabbar)

Has anyone found ways to improve this behavior, or is this wrong by design?

My expected behavior would be: If you use the new TabView with ".tabViewStyle(.sidebarAdaptable)" and have a two column NavigationSplitView in a tab, it automatically becomes a three column view when the top tabbar becomes a sidebar.

import SwiftUI

struct ContentView: View {
    var body: some View {
        TabView {
            Tab("Home", systemImage: "house") {
                HomeView()
            }
            Tab("Settings", systemImage: "gearshape") {
                Text("Settings")
            }
        }
        .tabViewStyle(.sidebarAdaptable)
    }
}

enum TabItem: String, Identifiable, CaseIterable {
    case first
    case second
    case third

    var id: String { rawValue }
    var content: String { rawValue }
}

struct HomeView: View {

    @State var selectedTab: String?

    var body: some View {
        NavigationSplitView {
            List(TabItem.allCases, selection: $selectedTab) { item in
                Text(item.content)
            }
        } detail: {
            if let selectedTab {
                Text("Detail: \(selectedTab)")
            } else {
                Text("Select an item")
            }
        }
    }
}

Hi @benjidea ,

That's a great point. That would be a very helpful feedback report if you wouldn't mind filing it at https://feedbackassistant.apple.com and pasting the FB number here afterwards. I tried out your project and see what your point is. I attempted to set the tab view style to be .tabBarOnly depending on the selection, but it didn't work as smoothly as I had hoped. As far as I've tried, there's no workaround for this.

To add to @Vision Pro Engineer point, I would suggest you either use a NavigationSplitView or TabView . Since they are both top level navigation containers embedding one inside the other could result in unexpected behaviors as you've discovered.

Thank you for the reply! The Feedback number ist FB14924996

@DTS Engineer Thanks for your input. I have a list-detail based app. To add more functionality I have tried a few things, including the new tab bar as it gives the user a lot of flexibility. I think this is hugely important, especially on the iPad, to give the apps there more power than just being inflated iPhone apps.

As I don't think it works quite as well for the user, I will continue to try out other options, but I wouldn't rule out TabView in conjunction with NavigationSplitView completely. I see potential there.

Same problem, and what's worse the app crashes on macOS, with an error indicating that their are two sidebar toggle:NSToolbar 0x60000102e6d0 already contains an item with the identifier com.apple.SwiftUI.navigationSplitView.toggleSidebar. Duplicate items of this type are not allowed.; { NSAssertFile = "NSToolbar.m"; NSAssertLine = 1609; }

iPadOS 18 TabView conflicts with NavigationSplitView
 
 
Q