SearchFieldPlacement
The placement of a search field in a view hierarchy.
Declaration
type SearchFieldPlacement =
| 'automatic'
| 'navigationBarDrawer'
| 'sidebar'
| 'toolbar'
| 'toolbarPrincipal'
| { navigationBarDrawer: { displayMode: SearchFieldPlacementNavigationBarDrawerDisplayMode; }; };struct SearchFieldPlacementPass a literal, or build one with SwiftUI.SearchFieldPlacement from import { SwiftUI } from 'swiftui-react-native'.
Type properties
'automatic'SwiftUI.SearchFieldPlacement.automaticSwiftUI places the search field automatically.
'toolbar'SwiftUI.SearchFieldPlacement.toolbarThe search field appears in the toolbar.
'toolbarPrincipal'SwiftUI.SearchFieldPlacement.toolbarPrincipalThe search field appears in the principal section of the toolbar.
Type methods
Overview
You can give a preferred placement to any of the searchable modifiers, like
View.searchable(text:placement:prompt:):
var body: some View {
NavigationView {
PrimaryView()
SecondaryView()
Text("Select a primary and secondary item")
}
.searchable(text: $text, placement: .sidebar)
}Depending on the containing view hierachy, SwiftUI might not be able to fulfill your request.
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.
- ContentToolbarPlacementA region of the interface that hosts its own toolbar content.
- 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.