I am using UISearchController (not UISearchDisplayController), i wanted to show a separate view when search is active. I dont want to use the current view.
Tried with self.searchController = UISearchController(searchResultsController: self.resultsController ). But this doesn't show anything.
Even tried this
func presentSearchController(_ searchController: UISearchController) {
DispatchQueue.main.async {
searchController.searchResultsController?.view.isHidden = false
}
}
func didPresentSearchController(_ searchController: UISearchController) {
searchController.searchResultsController?.view.isHidden = false
}
My default table data before search is active is as below, i want this table to hide and show separate view and pass the typed keyword to that new view. How can i achieve this?

As there is no direct segue to viewController, we need to explicitly refer the viewController we wanted to use.
I have used the below code and it loads my new controller when my searchBar is active.
Let me know if any better approach is available.