<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISearchController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISearchController"
  },
  "title" : "UISearchController"
}
-->

# UISearchController

A view controller that manages the display of search results based on interactions with a search bar.

```
@MainActor class UISearchController
```

## Overview

Use a search controller to provide a standard search experience of the contents of another view controller. When the user interacts with a [`UISearchBar`](/documentation/UIKit/UISearchBar), the search controller coordinates with a search results controller to display the search results.

In iOS, incorporate the search controller’s [`searchBar`](/documentation/UIKit/UISearchController/searchBar) into your own view controller’s interface. Display your view controller in whatever way is appropriate for your app. See [Displaying searchable content by using a search controller](/documentation/UIKit/displaying-searchable-content-by-using-a-search-controller) and [Using suggested searches with a search controller](/documentation/UIKit/using-suggested-searches-with-a-search-controller) to learn how to implement a search controller in your app.

In tvOS, start with a [`UISearchContainerViewController`](/documentation/UIKit/UISearchContainerViewController) to manage the presentation of the search controller. See [UIKit Catalog (tvOS): Creating and Customizing UIKit Controls](https://developer.apple.com/library/archive/samplecode/UICatalogFortvOS/Introduction/Intro.html#//apple_ref/doc/uid/TP40016433) to learn how to implement a search controller embedded inside a `UISearchContainerViewController` object.

> Note:
> Don’t use a ``doc://com.apple.uikit/documentation/UIKit/UISearchContainerViewController`` in iOS.

### Display search results

Specify a second view controller for displaying search results when you call [`init(searchResultsController:)`](/documentation/UIKit/UISearchController/init(searchResultsController:)). When the user interacts with the search bar, the search controller automatically displays the results controller with the results you specify. If your results view is full-screen in tvOS, set the [`searchControllerObservedScrollView`](/documentation/UIKit/UISearchController/searchControllerObservedScrollView) to the results controller as well, so the search bar scrolls with your content view.

Provide a [`UISearchResultsUpdating`](/documentation/UIKit/UISearchResultsUpdating) object to the search controller’s [`searchResultsUpdater`](/documentation/UIKit/UISearchController/searchResultsUpdater) property. Typically, the view controller with your searchable content also acts as the search results updater object, but you can use another object if you prefer. When the user interacts with the search bar, the search controller calls the appropriate [`UISearchResultsUpdating`](/documentation/UIKit/UISearchResultsUpdating) method, giving your object the opportunity to perform the search and update the contents of your search results view.

### Customize transitions

To customize the presentation or dismissal of the search results controller, set the search controller’s [`delegate`](/documentation/UIKit/UISearchController/delegate) property to an object that conforms to the [`UISearchControllerDelegate`](/documentation/UIKit/UISearchControllerDelegate) protocol. Then implement delegate methods in this object to receive presentation and dismissal events from the search controller.

## Topics

### Creating a search controller

[`init(searchResultsController:)`](/documentation/UIKit/UISearchController/init(searchResultsController:))

Creates and returns a search controller with the specified view controller for displaying the results.

[`init(coder:)`](/documentation/UIKit/UISearchController/init(coder:))

Returns an initialized search controller from data in the specified unarchiver.

[`init(nibName:bundle:)`](/documentation/UIKit/UISearchController/init(nibName:bundle:))

Returns an initialized view controller with the nib file in the specified bundle.

### Responding to presentation and dismissal

[`delegate`](/documentation/UIKit/UISearchController/delegate)

The search controller’s delegate.

[`UISearchControllerDelegate`](/documentation/UIKit/UISearchControllerDelegate)

A set of delegate methods for search controller objects.

### Managing the search results

[`searchBar`](/documentation/UIKit/UISearchController/searchBar)

The search bar to install in your interface.

[`searchResultsUpdater`](/documentation/UIKit/UISearchController/searchResultsUpdater)

The object responsible for updating the contents of the search results controller.

[`searchResultsController`](/documentation/UIKit/UISearchController/searchResultsController)

The view controller that displays the results of the search.

[`isActive`](/documentation/UIKit/UISearchController/isActive)

The presented state of the search interface.

### Configuring the search interface

[`obscuresBackgroundDuringPresentation`](/documentation/UIKit/UISearchController/obscuresBackgroundDuringPresentation)

A Boolean indicating whether to obscure the underlying content during a search.

[`hidesNavigationBarDuringPresentation`](/documentation/UIKit/UISearchController/hidesNavigationBarDuringPresentation)

A Boolean indicating whether to hide the navigation bar when searching.

[`automaticallyShowsCancelButton`](/documentation/UIKit/UISearchController/automaticallyShowsCancelButton)

A Boolean indicating whether the search controller manages the visibility of the search bar’s cancel button.

[`automaticallyShowsSearchResultsController`](/documentation/UIKit/UISearchController/automaticallyShowsSearchResultsController)

A Boolean indicating whether the search controller manages the visibility of its results controller.

[`showsSearchResultsController`](/documentation/UIKit/UISearchController/showsSearchResultsController)

A Boolean indicating whether the search results controller is visible when the search controller is active.

[`searchBarPlacement`](/documentation/UIKit/UISearchController/searchBarPlacement)

The placement of the search bar in the navigation bar.

[`ignoresSearchSuggestionsForSearchBarPlacementStacked`](/documentation/UIKit/UISearchController/ignoresSearchSuggestionsForSearchBarPlacementStacked)

A Boolean value you use to specify whether the search controller prevents search suggestions from displaying for a stacked search bar.

[`automaticallyShowsScopeBar`](/documentation/UIKit/UISearchController/automaticallyShowsScopeBar)

A Boolean indicating whether the search controller manages the visibility of the search bar’s scope bar.

[`scopeBarActivation`](/documentation/UIKit/UISearchController/scopeBarActivation-swift.property)

A mode that determines when the search controller shows and hides the scope bar.

[`UISearchController.ScopeBarActivation`](/documentation/UIKit/UISearchController/ScopeBarActivation-swift.enum)

Constants that specify the modes for showing and hiding the scope bar.

### Providing search suggestions

[`searchSuggestions`](/documentation/UIKit/UISearchController/searchSuggestions)

A list of suggestions to offer as shortcuts below the search field.

[`ignoresSearchSuggestionsForSearchBarPlacementStacked`](/documentation/UIKit/UISearchController/ignoresSearchSuggestionsForSearchBarPlacementStacked)

A Boolean value you use to specify whether the search controller prevents search suggestions from displaying for a stacked search bar.

[`UISearchSuggestionItem`](/documentation/UIKit/UISearchSuggestionItem)

A selectable search parameter.

[`UISearchSuggestion`](/documentation/UIKit/UISearchSuggestion)

A set of attributes that a selectable search suggestion must provide.

### Deprecated

[`searchControllerObservedScrollView`](/documentation/UIKit/UISearchController/searchControllerObservedScrollView)

The view with which the controller coordinates scrolling animations.

[`dimsBackgroundDuringPresentation`](/documentation/UIKit/UISearchController/dimsBackgroundDuringPresentation)

A Boolean indicating whether to dim the underlying content during a search.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)