I'm confused as to what the difference between a UISearchBar/UISearchBarDelegate and a UISearchBarController is.
Right now, this is what I'm doing to implement my search bar:
class SearchViewController: UIViewController {
@IBOutlet weak var searchBar: UISearchBar!
}
extension SearchViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
searchBar.resignFirstResponder()
if !searchBar.text!.isEmpty {
performSegue(withIdentifier: "Search", sender: searchBar.text!)
}
}
}
I've seen people online doing things like:
let searchController = UISearchController(searchResultsController: nil)
What is the difference between this and what I'm doing?