Recipe: Searching Through a Table

A search display controller is a kind of controller that enables user-driven searches. These controllers allow users to filter a table’s contents in real time, providing instant responsiveness to a user-driven query. It’s a great feature that lets users interactively find what they’re looking for, with the results updating as each new character is entered into the search field.

You create these controllers by initializing them with a search bar instance and a content controller, normally a table view, whose data source is searched. Recipe 9-5 demonstrates the steps involved in creating and using a search display controller in an application.

Searches are best built around predicates, enabling you to filter arrays ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.