Search code examples
swiftweb-servicessearchuisearchbaruisearchcontroller

UISearchController or another option for a service request result?


I've been reading some examples of the use of UISearchController that looks fine for searching and filtering results when you have a local data source. I instead would like the user to provide a string and to request a list of results to a service, then display the results in a table view.

Would it be UISearchController and a search bar suitable for this scenario? Or maybe just a simple text field? How would the most appropriate way to get the user input for his search be for a search by means of a service call?

I would appreciate some tutorial with similar purpose.

Thanks


Solution

  • I had the experience of creating an application that with help of http requests searches for data on the server and displays the results to the user. I recommend for the basics to use UIViewController with UISearchBar (+ UISearchBarDelegate) and UITableView (+ UITableViewDelegate, UITableViewDataSource).

    Sample view:

    enter image description here

    That app had difficult animations and view design. Because of that I can't use UISearchBarController. But, I you want to make search like apple recommended, use UISearchBarController.