searchFocused
Modifies this view by binding the focus state of the search field associated with the nearest searchable modifier to the given Boolean value.
Overloads
2 ways to call compose().searchFocused(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().searchFocused(binding: Binding<boolean>)nonisolated func searchFocused(
_ binding: FocusState<Bool>.Binding
) -> some ViewParameters
binding*Binding<boolean>The focus state to bind. When focus moves to the associated search field, the binding sets the bound value to
true. If a caller sets the value totrueprogrammatically, then focus moves to the search field. When focus leaves the search field, the binding sets the value tofalse. If a caller sets the value tofalse, SwiftUI automatically dismisses focus.
Return value
The modified view.
Discussion
To control focus by matching a non-boolean value, use the
View.searchFocused(_:equals:) modifier instead.
For more information about using searchable modifiers, refer to doc:Adding-a-search-interface-to-your-app.
See also
More in Focus.
- defaultFocusDefines a region of the window in which default focus is evaluated by assigning a value to a given focus state binding.
- focusableSpecifies if the view is focusable.
- focusedModifies this view by binding its focus state to the given Boolean state value.
- focusEffectDisabledAdds a condition that controls whether this view can display focus effects, such as a default focus ring or hover effect.