TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | Apache 2 |
ReleasedLast Release | Sep 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✓ |
Maintained by Matt Smollinger.
This is the iOS SDK wrapper and convenience framework to make interacting with a Pelias Geocoder instance (https://github.com/pelias/pelias) easier / faster / more better for iOS developers.
We recommend using CocoaPods (https://cocoapods.org/) to install the SDK. We have two currently supported subspecs: Core and MapkitExtensions. Core only relies on Foundation being available. MapkitExtensions relies on CoreLocation, MapKit, and the iOS 9.0+ Contacts Framework being available (and will add these to your project if you install using CocoaPods).
Here are some examples which show how easy it is to use the SDK. Be sure to read the documentation to see all the properties you can customize when making requests.
Find a place by searching for an address or name:
let text = "cafe"
let config = PeliasSearchConfig(searchText: text, completionHandler: { (searchResponse) -> Void in
let responseDictionary = searchResponse.parsedResponse?.parsedResponse
// update UI based on responseDictionary
})
_ = PeliasSearchManager.sharedInstance.performSearch(config)
Get real-time result suggestions with autocomplete:
let text = "cafe"
let point = GeoPoint.init(latitude: 40.74433, longitude: -73.9903)
let config = PeliasAutocompleteConfig(searchText: text, focusPoint: point, completionHandler: { (searchResponse) -> Void in
let responseDictionary = searchResponse.parsedResponse?.parsedResponse
// update UI based on responseDictionary
})
_ = PeliasSearchManager.sharedInstance.autocompleteQuery(config)
Find what is located at a certain coordinate location:
let point = GeoPoint.init(latitude: 40.74433, longitude: -73.9903)
let config = PeliasReverseConfig(point: point, completionHandler: { (searchResponse) -> Void in
let responseDictionary = searchResponse.parsedResponse?.parsedResponse
// update UI based on responseDictionary
})
_ = PeliasSearchManager.sharedInstance.reverseGeocode(config)
Get rich details about a place:
let gids = ["gid", "anotherGid"]
let config = PeliasPlaceConfig(gids: gids, completionHandler: { (searchResponse) -> Void in
let responseDictionary = searchResponse.parsedResponse?.parsedResponse
// update UI based on responseDictionary
})
_ = PeliasSearchManager.sharedInstance.placeQuery(config)
The SDK ships with a sample app which you can run directly within XCode
We welcome issues to be reported using the Github Issue tracker. However please review the currently open issues before reporting a bug to avoid issue tracker churn.
Please send any and all PRs you want! We do enforce good test coverage, so please make sure all your new code is covered, and that tests pass locally before submitting a pull request!
Please refer to the CHANGES.md document for major change history of the SDK.