Skip to content

letzgro/GooglePlacesPicker

Repository files navigation

GooglePlacesPicker

Swift IOS Pod. GooglePlacesPicker lets a user select an Google Places.

Import:

    import GooglePlacesPicker

Cocoapods:

    pod 'GooglePlacesPicker'
  1. You need to set up your API KEY like this

     GooglePlacesReciever.googlePlacesAPIKey = "[KEY]"
    
  2. Implement GooglePlacePickerViewControllerDelegate Methods which you need

     func googlePlacePicker(_ googlePlacePickerViewController: GooglePlacePickerViewController, didSelectGooglePlace googlePlace: GooglePlace)
    
     func googlePlacePickerViewControllerDidPressCancelButton(_ googlePlacePickerViewController: GooglePlacePickerViewController)
    
  3. Show GooglePlacesPicker

     let alert = GooglePlacePickerViewController()
     alert.delegate = self
     self.present(alert, animated: true, completion: nil)
    

alt text

To customize Picker simply inherite from GooglePlacePickerViewController and override updateUI method like this:

    import GooglePlacesPicker
    class TestGooglePlacePickerViewController: GooglePlacePickerViewController {
        
        override func updateUI() {
            super.updateUI()
            self.leftBarButtonItem?.tintColor = UIColor.blackColor()
            self.rightBarButtonItem?.tintColor = UIColor.blackColor()
            self.navigationBar?.barTintColor = UIColor.redColor()
        }
    }

Example Project https://github.com/letzgro/GooglePlacesPicker/tree/master/GooglePlacesPickerExample

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published