GooglePlacesAutocomplete alternatives and similar libraries
Based on the "API" category.
Alternatively, view GooglePlacesAutocomplete alternatives based on common mentions on social networks and blogs.
-
Typhoon
Powerful dependency injection for Objective-C ✨✨ (https://PILGRIM.PH is the pure Swift successor to Typhoon!!)✨✨ -
MonkeyKing
MonkeyKing helps you to post messages to Chinese Social Networks. -
Swifter Twitter
[DEPRECATED] :bird: A Twitter framework for iOS & OS X written in Swift -
Paste JSON as Code • quicktype
Xcode extension to paste JSON as Swift, Objective-C, and more -
Dip
Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances! -
TRON
Lightweight network abstraction layer, written on top of Alamofire -
Default
Modern interface to UserDefaults + Codable support -
mongo-swift-driver
The official MongoDB driver for Swift -
PXGoogleDirections
Google Directions API helper for iOS, written in Swift -
SwiftlySalesforce
The Swift-est way to build native mobile apps that connect to Salesforce. -
Federal Data SDK
Federal Data SDK built in the Swift programming language. Follow the link for the documentation: -
RandomUserSwift
👤 Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me -
PredictionIO SDK
PredictionIO iOS / macOS SDK -
Kraken
Simple Dependency Injection container for Swift. Use protocols to resolve dependencies with easy-to-use syntax! -
PPWeatherCheck
Incorporate with CoreLocation, Cocoapods, REST APIs, Alamofire, JSON, and UI Animation to Create a Weather Check Application. -
LogView
Put your interesting logs into view for showing.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of GooglePlacesAutocomplete or a related project?
README
GooglePlacesAutocomplete
A simple Google Places API autocompleting address entry view for iOS devices.
There are already a couple of solutions out there for this. GooglePlacesAutocomplete is different because it is 100% Swift, and aims to provide the simplest possible method of entering validated, autocompleted addresses.
No attempt has been made to integrate MapKit since displaying Google Places on a non-Google map is against their terms of service.
Requirements
- iOS 7.0+
- XCode 7.0+ / Swift 2.0
Installation
Embedded frameworks require a minimum deployment target of iOS 8.
To use GooglePlacesAutocomplete with a project targeting iOS 7, you must include the source files directly in your project. See the 'manual installation' section for instructions.
CocoaPods
CocoaPods is a dependency manager for Cocoa projects.
CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:
$ gem install cocoapods
To integrate GooglePlacesAutocomplete into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'GooglePlacesAutocomplete'
Then, run the following command:
$ pod install
Manual
Simply copy GooglePlacesAutocomplete.swift
and GooglePlacesAutocomplete.xib
to your project.
Note: Don't forget to add the PoweredByGoogle image to your xcassets.
Usage
Use the Google Developers Console to enabled the 'Google Places API Web Service' and create a 'Server' API key credential. In both cases do not use the iOS options.
import GooglePlacesAutocomplete // Not required when including source files directly in project
let gpaViewController = GooglePlacesAutocomplete(
apiKey: "[YOUR GOOGLE PLACES API KEY]",
placeType: .Address
)
gpaViewController.placeDelegate = self // Conforms to GooglePlacesAutocompleteDelegate
presentViewController(gpaViewController, animated: true, completion: nil)
GooglePlacesAutocompleteDelegate
supports three methods:
placesFound(places: [Place])
: Invoked whenever the Google Places API is calledplaceSelected(place: Place)
: Invoked when a new place is selectedplaceViewClosed()
: Invoked when the view is closed
Here's a complete example.
Place Details
From Google's documentation: "you can request more details about a particular establishment or point of interest by initiating a Place Details request. A Place Details request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating and reviews."
place.getDetails { details in
println(details.name) // Convenience accessor for name
println(details.latitude) // Convenience accessor for latitude
println(details.longitude) // Convenience accessor for longitude
println(details.raw) // Complete JSON data (see below)
}
/*
[
status: OK,
result: {
"address_components" = (
{
"long_name" = Paris;
"short_name" = Paris;
types = (
locality,
political
);
},
...
);
geometry = {
location = {
lat = "48.856614";
lng = "2.3522219";
};
...
*/
See the documentation for full response details.
Location Biasing
The Place Autocomplete API supports biasing results to a specified circle by passing a location
and a radius
parameter. This instructs the service to prefer showing results within that circle. Results outside of the defined area may still be displayed.
gpaViewController.locationBias = LocationBias(latitude: 48.8534275, longitude: 2.3582787999999937, radius: 1000)
Styling
The UINavigationController appearance can also easily be changed, for example:
gpaViewController.navigationBar.barStyle = UIBarStyle.Black
gpaViewController.navigationBar.translucent = false
gpaViewController.navigationBar.barTintColor = UIColor(red: 0.11, green: 0.27, blue: 0.53, alpha: 1.0)
gpaViewController.navigationBar.tintColor = UIColor.whiteColor()
gpaViewController.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "Zapfino", size: 16.0)!]
Also, to change the contents of the title bar:
gpaViewController.navigationItem.title = "Enter City"
gpaViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Cancel, target: gpaViewController, action: "close")
Contributing
- Fork it ( https://github.com/watsonbox/ios-google-places-autocomplete/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request