GooglePlacesPicker
Swift IOS Pod. GooglePlacesPicker lets a user select an Google Places.
Import:
import GooglePlacesPicker
Cocoapods:
pod 'GooglePlacesPicker'
-
You need to set up your API KEY like this
GooglePlacesReciever.googlePlacesAPIKey = "[KEY]"
-
Implement GooglePlacePickerViewControllerDelegate Methods which you need
func googlePlacePicker(_ googlePlacePickerViewController: GooglePlacePickerViewController, didSelectGooglePlace googlePlace: GooglePlace) func googlePlacePickerViewControllerDidPressCancelButton(_ googlePlacePickerViewController: GooglePlacePickerViewController)
-
Show GooglePlacesPicker
let alert = GooglePlacePickerViewController() alert.delegate = self self.present(alert, animated: true, completion: nil)
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