Skip to content
Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Update method naming Apr 30, 2019
LMGeocoderSwift Update method naming Apr 30, 2019
Screenshots Add Pod project Apr 29, 2019
.gitignore Initial commit Apr 29, 2019
LICENSE Add Pod project Apr 29, 2019
LMGeocoderSwift.podspec Update LMGeocoderSwift.podspec May 1, 2019
README.md Update README.md Apr 30, 2019
_Pods.xcodeproj Add Pod project Apr 29, 2019

README.md

LMGeocoderSwift

LMGeocoderSwift is a simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.

CI Status Version License Platform

Features

  • Wrapper for Geocoding and Reverse geocoding with blocked-based coding.
  • Use both Google Geocoding API and Apple iOS Geocoding Framework.

Requirements

  • iOS 8.0 or higher
  • Swift 5.0

Installation

LMGeocoderSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LMGeocoderSwift'

Objective-C Version

https://github.com/lminhtm/LMGeocoder

Usage

Geocoding

LMGeocoder.shared.geocode(addressString, service: .AppleService) { (results, error) in
                
    // Update UI
    if let address = results?.first, error == nil {
        DispatchQueue.main.async {
            self.coordinateLabel.text = "(\(address.coordinate?.latitude ?? 0), \(address.coordinate?.longitude ?? 0))"
        }
    }
}

Reverse Geocoding

LMGeocoder.shared.reverseGeocode(coordinate, service: .AppleService) { (results, error) in
                
    // Update UI
    if let address = results?.first, error == nil {
        DispatchQueue.main.async {
            self.addressLabel.text = address.formattedAddress ?? "-"
        }
    }
}

Cancel Geocode

LMGeocoder.shared.cancelGeocode()

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

License

LMGeocoderSwift is available under the MIT license. See the LICENSE file for more info.

Author

Minh Nguyen

You can’t perform that action at this time.