Modifying table view data source methods
As you learned in Chapter 14, Getting Started with MVC and Table Views, you can use UITableViewDataSource
methods to determine how many table view rows to display, and what to put in each row.
In the previous section, you added a new property, filteredTableData
, to hold an array of JournalEntry
instances that match the search text. You’ll modify the updateSearchResults(for:)
method to populate filteredTableData
with JournalEntry
instances that match the search text, and you’ll modify the UITableViewDataSource
methods to display the contents of filteredTableData
on the Journal List screen while the search bar is active. Follow these steps:
- In the Project navigator, click the JournalListViewController file. Modify the
updateSearchResults(for:)
method in theJournalListViewController
class as shown://MARK: - Search func updateSearchResults(for searchController: UISearchController) { guard let searchBarText...