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

# searchFocused(_:equals:)

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

## Declaration

```swift
nonisolated func searchFocused<V>(_ binding: FocusState<V>.Binding, equals value: V) -> some View where V : Hashable

```

## Parameters

- `binding`: The state binding to register. When focus moves to the associated search field, the binding sets the bound value to the corresponding match value. If a caller sets the state value programmatically to the matching value, then focus moves to the search field. When focus leaves the search field, the binding sets the bound value to nil. If a caller sets the value to nil, SwiftUI automatically dismisses focus.
- `value`: The value to match against when determining whether the binding should change.

## Return Value

Return Value The modified view.

## Discussion

Discussion To control focus by matching a simple boolean condition, use the searchFocused(_:) 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(_:)](swiftui/view/searchfocused(_:).md)
