tabViewSearchActivation(_:)
Configures the activation and deactivation behavior of search in the search tab.
Declaration
nonisolated func tabViewSearchActivation(_ activation: TabSearchActivation) -> some View
Discussion
Use this modifier on a TabView to change how search activation is handled. The exact activation behavior is determined by the TabSearchActivation you pass to this modifier:
struct TabExampleView: View {
@State private var text: String = ""
var body: some View {
TabView {
Tab("Books", systemImage: "book") {
BooksTab()
}
Tab(role: .search) {
NavigationStack {
SearchContent()
}
}
}
.searchable(text: $text)
.tabViewSearchActivation(.searchTabSelection)
}
}By default, search is only activated and deactivated by the user.