---
title: "willDismissSearchController(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisearchcontrollerdelegate/willdismisssearchcontroller(_:)"
---

# willDismissSearchController(_:)

Notifies the delegate that the system is about to automatically dismiss the search controller.

## Declaration

```swift
optional func willDismissSearchController(_ searchController: UISearchController)
```

## Parameters

- `searchController`: The doc://com.apple.uikit/documentation/UIKit/UISearchController object to dismiss.

## Discussion

Discussion The system only calls this method when it’s about to automatically dismiss the search controller. The system doesn’t call this method if you explicitly dismiss the search controller.

## See Also

### Presenting and dismissing the search controller

- [didDismissSearchController(_:)](uikit/uisearchcontrollerdelegate/diddismisssearchcontroller(_:).md)
- [didPresentSearchController(_:)](uikit/uisearchcontrollerdelegate/didpresentsearchcontroller(_:).md)
- [presentSearchController(_:)](uikit/uisearchcontrollerdelegate/presentsearchcontroller(_:).md)
- [willPresentSearchController(_:)](uikit/uisearchcontrollerdelegate/willpresentsearchcontroller(_:).md)
