static let text: SubmitTriggers
Defines triggers originating from text input controls like
TextField
and SecureField
.Availability 有効性
Technology
static let search: SubmitTriggers
In the example below, only the search field or search completions placed by the searchable modifier will trigger the view model to submit its current search query.
var viewModel = ViewModel()
NavigationView {
SidebarView()
DetailView()
}
.searchable(
text: $viewModel.searchText,
placement: .sidebar
) {
SuggestionsView()
}
.onSubmit(of: .search) {
viewModel.submitCurrentSearchQuery()
}
static let text: SubmitTriggers
TextField
and SecureField
.