LMGeocoderSwift

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

Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.

LMGeocoderSwift

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'
Ruby

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))"
        }
    }
}
Swift

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 ?? "-"
        }
    }
}
Swift

Cancel Geocode

LMGeocoder.shared.cancelGeocode()
Swift

Example

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

GitHub

Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.Read More

Latest commit to the master branch on 11-7-2022
Download as zip