测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可证 | MIT |
Released上次发布 | Nov 2015 |
SPM支持 SPM | ✗ |
由 Lukasz Solniczek 维护。
CQGoogleDirections
是一组用于简化使用 Google Directions API 的类。它将响应 JSON 转换为可供在您的应用程序中使用的一系列方便的对象。
开始使用 CQGoogleDirections
只需两行代码。
let directionAPI = CQGoogleDirections(from: CLLocationCoordinate2D(latitude: 52.237800, longitude: 21.049662), to: CLLocationCoordinate2D(latitude: 52.226974, longitude: 21.056588), wayPoints: nil)
directionAPI.calculateDirections { response in
switch response.result {
case .Success:
print(response.routes)
case .Failure(_):
print("Error")
}
}
CQRoute
对象CQRoute
是主要对象,用于封装关于 overviewPolylines
、bounds
和 legs
的信息。要访问 CQRoute
,您需要
case .Success:
if let routes = response.routes as CQRoutes? {
//use routes object
}
然后在终端中运行以下命令:
pod install
现在,您应该可以从代码中简单地导入模块,例如
import CQGoogleDirections
Lukasz Solniczek, l(dot)solniczek(at)gmail(dot)com
CQGoogleDirections 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。