I want to change the color of the text and icon in the iOS 11 searchbar when it is embedded in the navigation bar. So placeholder text, search text and search icon.
Put
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
and
UISearchBar.appearance().tintColor = UIColor.white in the AppDelegate.
UISearchBar.appearance().tintColor = UIColor.white
AppDelegate
Alternatively, put them both in [UIViewController viewDidLoad:]
[UIViewController viewDidLoad:]