I recently started developing for iOS and I ran into my first problem. I'm trying to provide a searchbar inside a NavigationController scene, the results are shown in a different view because I'm using the searchResultsController method, where another TableView gets called with all results in it. From there you can click on a certain result cell and get details. What I'm trying to figure out is, how you can integrate the results into the main navigation.
I see a lot of application that seem to use that kind of approach, e.g. facebook. In your news feed you have you a search bar, when you click on it, it opens a tableView (searchResultsController method?), from there you can click on a result and see the detail view. In contrast to my app you still have a navigation bar on top, where you can go back to search result and from there back to the main news feed.
Obviously I could simply add a button to dismiss my detail view which would bring me back to the main or searchresult view, but I guess there has to be a better way to do it. Or are those apps also just "fake" a navigation bar and use another approach? I want to it be like this:
main view (with navigation bar and searchbar) -> search result -> details AND then a back button inside details to go details->search result->main view
Right now I don't get how I put this together, as the tableView with my results is obviously not directly connected to the main view, as I'm using the following method
let tableViewController = storyboard!.instantiateViewController(withIdentifier: "TableViewController") as! TableViewController resultSearchController = UISearchController(searchResultsController: tableViewController) resultSearchController?.searchResultsUpdater = tableViewController resultSearchController?.hidesNavigationBarDuringPresentation = false resultSearchController?.dimsBackgroundDuringPresentation = true definesPresentationContext = true
Currently my storyboard looks like this: https://i.imgur.com/EoTICbp.png