Building a searchable UITableView in iOS 9 – Part 1

In this 4 part course I’ll show you how to build a searchable UITableView using iOS 9.1 and Xcode 7.1.

  • Part 1 will talk you through how to build a UITableView with dummy data
  • In Part 2 I’ll show you how to use a UISearchController to display a second table view
  • In Part 3 we’ll discuss how to filter results using an NSPredicate
  • And in Part 4 we’ll see how to communicate those search results to the second table view via KVO.

The whole course is about 50 minutes long, and I’ll explain details step by step. All code is Objective-C, and the the full project I’m building is available on GitHub.

Sounds interesting? Join me now and I’ll see you on the other side 😉

Demo Project

Here’s the code I’ve built during the screencast. As promised, I’ve also implemented the UISearchControllerDelegate methods – just in case you need them:

Further Reading

The Apple Class References aside, I’ve also put together written instructions on how to create this project in my next article. If you prefer written instructions, go check it out here – it covers the same steps as these videos 🙂

Watch the full course in one convenient playlist:
Catch this episode on my iOS Dev Diary Podcast:

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

2 thoughts on “Building a searchable UITableView in iOS 9 – Part 1

  1. Hi Jay,
    Very good tutorial and it helped me a lot in my project. I use core data with AccountsTitle and Category as section. When I search for AccountTitle, i pass the search text to the second SearchViewController. There I use that search to create a Predicate that retrieves results using NSFetchResultsController. Filtration works well but the issue is it lags. I wanted something as smooth as the search feature in Contacts on iOS. Any idea how to fix this. Thanks,


    1. Thanks Nabeel, great to hear my tutorial helped you out! There are two things you can try to speed up performance: first, you can add a cache to the NSFetchedResultsController. This may help retrieve results quicker for all your records. Apple’s template does it like this:

      The predicate however is where it can get tight and laggy, and the only real option to speed up queries is to make them simpler to process. For example, BEGINSWITH is less expensive than CONTAINS. Ignoring case and diacritics is faster than checking for them, and so forth. See how you can help iOS retrieve the most important info.

      Good luck and all the best!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.