I have a SearchController with a search bar that is currently hidden. I do not need the user to be able to type in it. As you can see, there is a blank space where the searchBar would be:
Is there a way to also hide this? Or to make it smaller or reposition it?
This is how I set up the searchController:
override func viewDidLoad() {
initSearchController()
}
let searchController = UISearchController()
let searchBar = UISearchBar()
func initSearchController() {
searchController.loadViewIfNeeded()
searchController.searchResultsUpdater = self
navigationItem.searchController = searchController
searchController.definesPresentationContext = true
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.enablesReturnKeyAutomatically = false
searchController.searchBar.returnKeyType = UIReturnKeyType.done
navigationItem.hidesSearchBarWhenScrolling = false
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.isHidden = true
searchController.searchBar.becomeFirstResponder()
}

You only need to set the searchController if needed.