UISearchbar clearButton forces the keyboard to appear

This is an old question and I just came across the same issue and managed to solve it the following way: When the searchBar:textDidChange: method of the UISearchBarDelegate gets called because of the user tapping the ‘clear’ button, the searchBar hasn’t become the first responder yet, so we can take advantage of that in order … Read more

How to make keyboard dismiss when I press out of searchbar on Swift?

try this : self.mySearchController.searchBar.endEditing(true) replace mySearchController with your created controller name.. If you did not create it programmatically but instead you just dragged a search bar from library then IBoutlet your searchable to your class and reference it as: self.mySearchBar.endEditing(true)

tech