CLHelper 1.0.6

CLHelper 1.0.6

Maintained by Abhishek.



CLHelper 1.0.6

Core Location Helper

CI Status Version License Platform

Features

Core Location framework supports majorly,

  • User Current Location
  • Geocoding (via Apple Geocoder)
  • Reverse Geocoding (via Apple Geocoder)
  • Geocoding (via Google Places APIs)
  • Near By Places (via Google Landark APIs)
  • Geofencing

And, this helper class will cover all the functionality under the single hood.

Installation

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

pod 'CLHelper'

Usage

First, import the module in your screen,

import CLHelper

Current Location Update

*If There is sucess, then you'll get an array of locations of CLLocation type.

CLHelper.shared.getLocation { (locations, error) in

    // Latest Coordinate
    print(locations?.last)
}
  • If you have error occured, then there is an object of CLHelperError
CLHelper.shared.getLocation { (locations, error) in

    print(error?.localizedText)
}

Geocoding

It will convert your address string into coordinate (lat-long).

CLHelper.shared.getCoordinate(fromAddress: "New Delhi") { (coordinate, error) in

        guard error == nil else {

            print(error.localizedText)
            return
        }

        // Get Coordinate
        print(coordinate?.latitude)
        print(coordinate?.longitude)

}

Reverse Geocoding

It will convert your coordinate (i.e. latitude longitude) into human-readable geographical address.

// Gurgaon Coordinate
let coordinate = Coordinate(latitude: 28.4595, longitude: 77.0266)

CLHelper.shared.getAddress(fromCoordinate: coordinate) { (address, error) in

        guard error == nil else {
            print(error?.localizedText)
            return
        }

        if let suitedAddress: GeographicalAddress = address?.first {
        print(suitedAddress)
    }
}

Versions Log

v1.0.6

  • Added Travis CI

v1.0.5

  • README Updated

v1.0.4

  • Singleton Class
  • Example Project Added
  • Added Comments in CLHelper.

v1.0.1

  • User Current Location
  • Geocoding (via Apple Geocoder)
  • Reverse Geocoding (via Apple Geocoder)

Contributor

Abhishek Kumar Ravi

[email protected]

License

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