| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is the Geocoding SDK for iOS by Unwired Labs to use Unwired Labs geocoding service on iOS at ease.
Unwired Labs Geocoding SDK works on iOS 10+ and requires ARC to build. It uses the Foundation.framework by Apple
You will need an API key from Unwired Labs to initialise this SDK. [Sign up for a free Developer token] (http://unwiredlabs.com/trial)
You can directly add the source files to your project, they are found under 'Unwired Labs iOS SDK'.
You can also import Unwired Labs Geocoding SDK project as a static library to your project or workspace.
Unwired Labs Geocoding SDK is built on top of NSURLSession with a completionBlock. All requests happens asynchronously.
First to initialise the SDK there is a convenience initialiser.
let geocoder :ULGeocoder = ULGeocoder.init(apiKey: "YOUR-API-KEY")
To use Reverse Geocoding, pass latitude and longitude as NSNumber as given below. The response from the server is parsed into objects as listed further down in this readme.
gecoder.reverseGeocode(latitude: 17.4206485, longitude: 78.4008997) { (response, success, error) in
if success {
//Use response to get individual elements
} else {
//Failed requests
print(response.message)
}
}
To use Forward Geocoding, pass a query string to the method as given below. The response from the server is parsed into objects as listed further down in this readme.
gecoder.forwardGeocode(address: "Empire state building") { (response, success, error) in
if success {
//Use response to get individual elements
} else {
//Failed requests
print(response.message)
}
}
Use response.locations[0].<component> , where component can be any member as follows:
| Component | Description |
|---|---|
| display_name | Matched Address name for the given location |
| house_number | House Number |
| road | Road Name |
| neighbourhood | Neighbourhood |
| suburb | Suburb |
| city | City name (normalized form of city, town, village, hamlet) |
| county | County name (normalized form of county, state_district) |
| country | Country name |
| country_code | Country code |
| postcode | Postal code |
The API only returns components that have valid values for a location. Component town is normalized to city to make things simple. Do check for nil before using any component
| Back | FazBrowse Home | New Git URL |