---
title: "searchController(_:willChangeTo:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisearchcontrollerdelegate/searchcontroller(_:willchangeto:)"
---

# searchController(_:willChangeTo:)

Notifies the delegate before the search bar placement changes.

## Declaration

```swift
optional func searchController(_ searchController: UISearchController, willChangeTo newPlacement: UINavigationItem.SearchBarPlacement)
```

## Parameters

- `searchController`: The search controller associated with the search bar.
- `newPlacement`: The new search bar placement.

## Discussion

Discussion The system calls this method before a search bar placement change occurs, such as in response to a layout change that alters the amount of available space in the navigation bar. Implement this method if you need to make any custom changes to your search suggestions UI according to the new search bar placement. The system calls this method before searchController(_:didChangeFrom:).

## See Also

### Responding to search bar placement updates

- [searchController(_:didChangeFrom:)](uikit/uisearchcontrollerdelegate/searchcontroller(_:didchangefrom:).md)
