Changing the color of the icons in a UItextField inside a UISearchBar
I'm trying to customise the appearance of the search bar in my search controller. Setting the background and text colors works fine but I just didn't find a way to change the color of the icons in the text field, specifically the magnifying glass and the x button. I've found this Objective-C code which should do what I want but I'm struggling to translate it to Swift: (EDIT: Skip to the first answer for the working Swift 3 solution.) UITextField *searchBarTextField = [self.searchDisplayController.searchBar valueForKey:@"_searchField"]; // Magnifying glass icon. UIImageView *leftImageView =