---
title: "searchFocused(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/searchfocused(_:)"
---

# searchFocused(_:)

Modifies this view by binding the focus state of the search field associated with the nearest searchable modifier to the given Boolean value.

## Declaration

```swift
nonisolated func searchFocused(_ binding: FocusState<Bool>.Binding) -> some View

```

## Parameters

- `binding`: 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 to true programmatically, then focus moves to the search field. When focus leaves the search field, the binding sets the value to false. If a caller sets the value to false, SwiftUI automatically dismisses focus.

## Return Value

Return Value The modified view.

## Discussion

Discussion To control focus by matching a non-boolean value, use the searchFocused(_:equals:) modifier instead. For more information about using searchable modifiers, refer to Adding a search interface to your app.

## See Also

### Managing focus state

- [focused(_:equals:)](swiftui/view/focused(_:equals:).md)
- [focused(_:)](swiftui/view/focused(_:).md)
- [isFocused](swiftui/environmentvalues/isfocused.md)
- [FocusState](swiftui/focusstate.md)
- [FocusedValue](swiftui/focusedvalue.md)
- [Entry()](swiftui/entry().md)
- [FocusedValueKey](swiftui/focusedvaluekey.md)
- [FocusedBinding](swiftui/focusedbinding.md)
- [searchFocused(_:equals:)](swiftui/view/searchfocused(_:equals:).md)
