ContentToolbarPlacement
A region of the interface that hosts its own toolbar content.
Declaration
type ContentToolbarPlacement = 'tabViewSidebar';struct ContentToolbarPlacementPass a literal, or build one with SwiftUI.ContentToolbarPlacement from import { SwiftUI } from 'swiftui-react-native'.
Type properties
Overview
Some containers draw a bar that belongs to the container as a whole rather
than to the view currently on screen, such as the sidebar of a TabView
that uses the TabViewStyle.sidebarAdaptable style. Pass a value of this
type to View.contentToolbar(for:content:) to put items in one of those
bars.
The following example adds a button to the sidebar of a tab view, where it stays put as someone moves between tabs:
TabView {
Tab("Lights", systemImage: "lightbulb") {
LightsView()
}
Tab("Locks", systemImage: "lock") {
LocksView()
}
}
.tabViewStyle(.sidebarAdaptable)
.contentToolbar(for: .tabViewSidebar) {
ToolbarItem {
DisconnectDevicesButton()
}
}Each placement accepts only some ToolbarItemPlacement values. Check the
documentation of the placement you use before you rely on a position.
From Apple’s SwiftUI documentation. Code samples there are Swift.
Used by
See also
More in Navigation.
- AdaptableTabBarPlacementA placement for tabs in a tab view using the adaptable sidebar style.
- AutomaticNavigationTransitionA style that automatically chooses the appropriate presentation transition for the current context.
- CrossFadeNavigationTransitionA navigation transition that cross-fades between the appearing view and the disappearing view.
- DismissSearchActionAn action that can end a search interaction.
- NavigationBarItemTitleDisplayModeA style for displaying the title of a navigation bar.
- NavigationPathA type-erased list of data representing the content of a navigation stack.
- NavigationPathChainNavigationPath with chained calls: SwiftUI.NavigationPath.append(...).
- NavigationPathCodableRepresentationA serializable representation of a navigation path.
- NavigationSplitViewColumnA view that represents a column in a navigation split view.
- NavigationSplitViewVisibilityThe visibility of the leading columns in a navigation split view.
- NavigationTransitionA type that defines the transition to use when navigating to a view.
- OpenURLActionAn action that opens a URL.