My search bar has default gray text, but I want it to be white text. I can't figure out how to use swift to change the scope bar text color, and you are unable to do it from storyboard. The closest I've found is
searchBarOutlet.setScopeBarButtonTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:UIControlState.Normal)
but alas this won't work either. Any ideas?
In my case for swift 3.0
(mySearchBar.value(forKey: "searchField") as? UITextField)?.textColor = UIColor.white
Its a little hard to access the Textfield inside the UISearchbar.
This is how it works:
Shorter solution:
Swift 3