I need a tableview to be presented modally after user taps on the search bar, and then be able to have the tableview present things the user searched, like Instagram\'s sear
To make the search results of a UISearchController
appear in a new UITableView
of your choice, do this:
let searchController = UISearchController(searchResultsController: myTableViewController)
instead of this:
let searchController = UISearchController(searchResultsController: nil)
Passing a view controller to the constructor allows the UISearchController
to display the view controller at appropriate times (i.e. when the search is active). This is what you need to do.
Passing nil
means, I'm using my own view controller (and table view).