When setting the status bar to hidden
override var prefersStatusBarHidden: Bool {
return true
}
and initialize normal searchController
using
let searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
It looks normal if it is unedited, however, if you click on the search bar, the navigation title will be hidden, and there will be a small indentation between the search bar and the top edge, which is very visually violated.
The solution is appreciated.
Minimal example
https://github.com/DJBen/SearchBarNoTopPadding

source
share