Search code examples
iosswiftgoogle-mapsuitextfieldgmsautocomplete

Google maps autocomplete change color


I am searching for change color of GMSAutocompleteViewController

Here is what I am getting:

Screenshot

I want the textfield to be white with white cancel button.


Solution

  • Swift 3

    @IBAction func searchCityBtn(_ sender: Any) {
            let autocompleteController = GMSAutocompleteViewController()
            autocompleteController.delegate = self
            UINavigationBar.appearance().barTintColor = UIColor(red: 44.0/255, green: 44.0/255, blue: 49.0/255, alpha: 1.0)
            UINavigationBar.appearance().tintColor = UIColor.white
    
            UISearchBar.appearance().setTextColor(UIColor.white)
            UISearchBar.appearance().barStyle = UIBarStyle.default
            UISearchBar.appearance().setPlaceholderTextColor(.white)
            UISearchBar.appearance().setSearchImageColor(.white)
    
            self.present(autocompleteController, animated: true, completion: nil)
        }
    

    more info about what you can edit here.... Thank god they updated their framework and doc! Cheers!