I am a newbie to Swift and I am trying to add search functionality to my UITableView
which is in a UIViewController
class. I googled a lot and foun
For those looking for a bit more context on all the aspects of implementing this, here's a tutorial on how to implement UISearchController
In addition to the above answer by Andy Ibanez, you also need to add code to your UITableViewDataSource methods to show the newly filtered results in the tableview.
Also, don't forget to call tableView.reloadData()
in your updateSearchResults method - the UISearchController does not automatically tell the tableView to reload its data.