Updating PrepareTVC
Being a CoreDataTVC
subclass, most of the legwork in configuring PrepareTVC
for search has already been done. The remaining configuration will be specific to the data the table view displays. A UISearchDisplayController
delegate method will also be implemented in PrepareTVC
. This method will be called every time the user types text into the search bar. Provided it has a length greater than zero, a predicate will be created from the given search string. This predicate will be given to the reloadSearchFRCForPredicate
method so it can reload searchFRC
. The section name key path and sort descriptors provided should match those used to populate the PrepareTVC
. Listing 12.10 shows the code involved.
Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications 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.