I am currently using the following method to stop the cancel button item from showing up in the search bar. I have a custom UIButton that I would like to use in
UIButton
Swift 4.2, 4.0+ of Rajneesh071 answer
Swift
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { searchBar.setShowsCancelButton(false, animated: true) }