Contents

SearchFieldPlacement

The placement of a search field in a view hierarchy.

Declaration

struct SearchFieldPlacement

Mentioned in

Overview

You can give a preferred placement to any of the searchable modifiers, like 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.

Topics

Getting a search field placement

Supporting types

Type Properties

See Also

Searching your app’s data model