Check my following code:
struct ContentView: View {
var body: some View {
TabView {
Tab("Firsttt", systemImage: "plus") {
MainScreen(name: "First")
}
.defaultVisibility(.hidden, for: .sidebar)
Tab("Seconddd", systemImage: "plus") {
MainScreen(name: "Second")
}
.defaultVisibility(.hidden, for: .sidebar)
Tab("Thirddd", systemImage: "xmark") {
MainScreen(name: "Third")
}
.defaultVisibility(.hidden, for: .sidebar)
TabSection {
Tab("Third", systemImage: "plus") {
MainScreen(name: "Third")
}
Tab("Fourth", systemImage: "plus") {
MainScreen(name: "Fourth")
}
} header: {
Label("Group", systemImage: "plus")
}
.defaultVisibility(.hidden, for: .tabBar)
TabSection {
Tab("Section 1", systemImage: "plus") {
MainScreen(name: "Fourth")
}
Tab("Section 2", systemImage: "plus") {
MainScreen(name: "Fourth")
}
Tab("Section 3", systemImage: "plus") {
MainScreen(name: "Fourth")
}
} header: {
Label("More", systemImage: "minus")
}
.defaultVisibility(.hidden, for: .tabBar)
}
.tabViewStyle(.sidebarAdaptable)
}
}
My expectation is it would show three tab in tab mode. And two sections in sidebar mode. Side bar mode works as expected but tab bar shows only the first tab.