GoogleDirections-iOS 1.0

GoogleDirections-iOS 1.0

Javier Castaneda维护。



 
依赖项
Alamofire>= 0
Unbox>= 0
 

GoogleDirections-iOS

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,并在 Example 目录中首先运行 pod install

要求

安装

GoogleDirections-iOS 通过 CocoaPods 提供。要安装它,只需添加以下行到您的Podfile。

pod 'GoogleDirections-iOS'

使用

  • 首先我们需要: import GoogleDirections_iOS
  • 现在我们可以使用它了
// Set your APIKEY
let apiKey = "YOUR APIKEY"
// Creating origin Location
let chapultepecCastle = CLLocationCoordinate2D(latitude: 19.422503,
longitude: -99.182065)
// Creating destination Location
let garibaldiPlaza = CLLocationCoordinate2D(latitude: 19.441267,
longitude: -99.139456)
// Creating first waypoint Location
let reforma77 = CLLocationCoordinate2D(latitude: 19.433375,
longitude: -99.154434)
// Creating second waypoint Location
let independenceAngel = CLLocationCoordinate2D(latitude: 19.427021,
longitude: -99.167695)

//create the request, if you don't have waypoints set .none
let request = GoogleDirectionsRequest.directionsWithCoordinates(origin: chapultepecCastle, destination: garibaldiPlaza, mode: .bicycle, wayPoints: [reforma77, independenceAngel], apiKey: apiKey)

//Perform the request
Network.requestJSON(request) { (result, error) in

    if let e = error {
        print(e.localizedDescription)
    }
    if let jsonDic = result as? JSON, let direction = GMDirection(json: jsonDic) {
        print("status: \(direction.status ?? "")")
        print("\n\npolyline: \(direction.routes?.first?.overviewPolyline ?? "")")
    }

}

作者

JDandini, [email protected]

许可

GoogleDirections-iOS 在MIT许可下可用。更多详细信息请参阅LICENSE文件。