SearchFieldPlacement

The placement of a search field in a view hierarchy.

StructureiOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+SearchFieldPlacement in SwiftUI

Declaration

React
type SearchFieldPlacement =
  | 'automatic'
  | 'navigationBarDrawer'
  | 'sidebar'
  | 'toolbar'
  | 'toolbarPrincipal'
  | { navigationBarDrawer: { displayMode: SearchFieldPlacementNavigationBarDrawerDisplayMode; }; };
Swift
struct SearchFieldPlacement

Pass a literal, or build one with SwiftUI.SearchFieldPlacement from import { SwiftUI } from 'swiftui-react-native'.

Type properties

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.