defaultTabBarPlacement(_:)
Specifies the preferred placement for the tabs of a Tabview in the Sidebaradaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown.
Declaration
nonisolated func defaultTabBarPlacement(_ defaultPlacement: AdaptableTabBarPlacement) -> some View
Discussion
On platforms that support adapting between a sidebar and tab bar (currently iPadOS), use defaultAdaptableTabBarPlacement(_:) to configure the adaptable tab bar.
This modifier is effective on platforms where the sidebarAdaptable style statically resolves to either a sidebar or tab bar, such as iPhone, macOS, tvOS, and visionOS. On iPadOS (where the bar is adaptable), this modifier has no effect.
The following example shows a TabView that prefers to display a sidebar on platforms where the bar cannot morph:
TabView {
Tab("Home", systemImage: "house") {
HomeView()
}
Tab("Favorites", systemImage: "star") {
FavoritesView()
}
}
.tabViewStyle(.sidebarAdaptable)
.defaultTabBarPlacement(.sidebar)