CQGoogleDirections 0.1.8

CQGoogleDirections 0.1.8

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2015
SPMSupports SPM

Maintained by Lukasz Solniczek.



  • By
  • Lukasz Solniczek

CQGoogleDirections

CQGoogleDirections is a small set of classes create to simplify use of Google Direction API. CQGoogleDirections turn respons JSON into set of convenient objects you can use in your application.

Usage

To start using CQGoogleDirections you need only 2 lines of code:

Create a CQGoogleDirections object:
let directionAPI = CQGoogleDirections(from: CLLocationCoordinate2D(latitude: 52.237800, longitude: 21.049662), to: CLLocationCoordinate2D(latitude: 52.226974, longitude: 21.056588), wayPoints: nil)
Run API request and handle return:
directionAPI.calculateDirections { response in
    switch response.result {
    case .Success:
        print(response.routes)
    case .Failure(_):
        print("Error")
    }
}
Access to CQRoute object:

CQRoute is main object which encapsulates information about overviewPolylines, bounds and legs. To access CQRoute you need to:

case .Success:
    if let routes = response.routes as CQRoutes? {
        //use routes object
    }

Requirements

  • Runs on iOS 8 at least, or above.
  • Compatible with Swift 2.0 / Xcode 7 and later.

Installation

Then run the following command from the Terminal:

pod install

Now, from your code, you should be able to simply import the module like this:

import CQGoogleDirections

TODO

  1. Add service for all Google Direction API params
  2. Handle Google Direction API errors
  3. Write tests
  4. Create better library example

Author

Lukasz Solniczek, l(dot)solniczek(at)gmail(dot)com

License

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