<!--
{
  "availability" : [
    "iOS: 3.0.0 - 8.0.0",
    "iPadOS: 3.0.0 - 8.0.0",
    "macCatalyst: 13.1.0 - 13.1.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISearchDisplayController/init(searchBar:contentsController:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISearchDisplayController(im)initWithSearchBar:contentsController:"
  },
  "title" : "init(searchBar:contentsController:)"
}
-->

# init(searchBar:contentsController:)

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

```
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

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

---

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)