---
title: endSearchInteraction()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nssearchtoolbaritem/endsearchinteraction()
---

# endSearchInteraction()

Ends a search interaction by giving up the first responder and adjusting the size of the search field to the available width for the toolbar item if necessary.

## Declaration

```swift
func endSearchInteraction()
```

## Discussion

Discussion Use beginSearchInteraction() and endSearchInteraction() to programmatically control a search.

## See Also

### Controlling search interactions

- [beginSearchInteraction()](appkit/nssearchtoolbaritem/beginsearchinteraction().md)
