I\'m trying to hide the Cancel button of the search bar in the UISearchController, but unfortunately setting the following in viewDidLoad() does not work:
ov
The same answer as given by @Griffith and @Abhinav but using extension:
extension UISearchBar { override open func layoutSubviews() { super.layoutSubviews() setShowsCancelButton(false, animated: false) } }
This code is from Swift 4.