Last month I started working on BikeSpot again. The main goal for the next release is better location search. The location search had the following limitations:
It was limited to locations in San Francisco only. While I currently only have bike rack data in San Francisco, I want search to be available in other cities as well. Bike parking data can be crowd sourced, so the app should not prevent any users from searching in other locations.
There was no autocomplete. Everyone expects and is used to autocomplete when searching. Not having it is just a bad user experience.
So I decided to use Google Maps and take advantage of its location search and place auto complete.
Google Maps SDK for iOS handles responses to user gestures.
Google Places API for iOS features autocomplete.
Switching from MKMapView to GMSMapView
- Custom my location button
- Implement GMSMapViewDelegate
- Camera position zoom
- Google Places API for iOS is packaged with the Google Maps SDK for iOS.
- Adding custom marker
Using Google Places API for autocomplete
Two ways for autocomplete:
- Autocomplete UI control - and there are different methods within this one
- Get place predictions programmatically
After playing with different methods, I settled on adding a search bar to the navigation bar because it was the least intrusive to my existing UI
Google Places API iOS limitation
- Cannot search using search string
- Must tap on a place in the autocomplete list to search
If you use the Google Maps SDK for iOS in your application, you must include the attribution text as part of a legal notices section in your application. Including legal notices as an independent menu item, or as part of an “About” menu item, is recommended.
You can get the attribution text by making a call to [GMSServices openSourceLicenseInfo].