---
title: "init(searchBar:contentsController:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uisearchdisplaycontroller/init(searchbar:contentscontroller:)"
---

# init(searchBar:contentsController:)

Returns a display controller initialized with the given search bar and contents controller.

## Declaration

```swift
init(searchBar: UISearchBar, contentsController viewController: UIViewController)
```

## Parameters

- `searchBar`: A search bar. The search bar must not currently be associated with another search display controller.
- `viewController`: The view controller that manages display of the original contents that are to be searched. The view controller must not currently be associated with another search display controller.

## Return Value

Return Value A search display controller initialized with the given search bar and contents controller.
