defaultAdaptableTabBarPlacement

Specifies the default placement for the tabs in a tab view using the adaptable sidebar style.

Declaration

React
compose().defaultAdaptableTabBarPlacement(
  defaultPlacement?: SwiftUI.AdaptableTabBarPlacement
)
Swift
nonisolated func defaultAdaptableTabBarPlacement(
    _ defaultPlacement: AdaptableTabBarPlacement = .automatic
) -> some View

Parameters

Discussion

This modifier is only effective on iPadOS in the TabViewStyle.sidebarAdaptable style. In any other configuration, the system ignores it.

The following example shows a TabView with three tabs, where the tab view displays the sidebar representation when the app initially launches.

TabView(selection: $selection) {
    Tab("Home", systemImage: "house", value: MyTab.home) {
        MyHomeView()
    }

    Tab("Downloads", systemImage: "square.and.arrow.down.fill",
        value: MyTab.downloads
    ) {
        MyDownloadsView()
    }

    Tab("Browse", systemImage: "list.bullet", value: MyTab.browse) {
        MyBrowseView()
    }
}
.tabViewStyle(.sidebarAdaptable)
.defaultAdaptableTabBarPlacement(.sidebar)

See also

More in Navigation.