0

i'm trying to show a searchController on buttonClick. However it seem to create an error when the button is clicked. I get an error on the presentViewController row. What am i doing wrong in order to achieve this?

by the way i'm having this code in a tableViewController

func searchButtonClicked(sender: UIBarButtonItem) {
    searchController = UISearchController(searchResultsController: self)
   // searchController.searchResultsUpdater = self
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.dimsBackgroundDuringPresentation = false
    self.definesPresentationContext = true
    self.presentViewController(self.searchController, animated: true, completion: nil)
}
Peter Pik
  • 11,023
  • 19
  • 84
  • 142

0 Answers0