The search bar to install in your interface.
- iOS 8.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Before presenting your searchable content, install the search bar somewhere in your view hierarchy. The search bar becomes the starting point for searching your contents. Interactions with the search bar are handled automatically by the
UISearch object, which notifies the object in the
search property whenever the search information changes.
You can provide a custom search bar by subclassing
UISearch and overriding this property to return your custom implementation. To ensure the correct configuration of your search bar, lazily initialize it when it’s first requested, as shown in the code below.