ASMapLauncher地图应用辅助

联合创作 · 2023-09-26 11:06

ASMapLauncher 是一个用 Swift 写成的 iOS 库,帮助使用各类地图 App 进行导航。


首先,启动 ASMapLauncher,检查将要选择的地图应用程序是否已安装在设备上。



mapLauncher = ASMapLauncher()
var isInstalled = mapLauncher.isMapAppInstalled(ASMapApp.ASMapAppGoogleMaps)

然后,启动被选择的地图应用程序。



if isInstalled {
    var destination: CLLocation! = CLLocation(latitude: 41.0053215, longitude: 29.0121795)
    var fromMapPoint: ASMapPoint! = ASMapPoint(location: CLLocation(latitude: currenctCoordinate.latitude, longitude: currenctCoordinate.longitude), name: "", address: "")
    var toMapPoint: ASMapPoint! = ASMapPoint(location: CLLocation(latitude: destination.coordinate.latitude, longitude: destination.coordinate.longitude), name: "", address: "")
    mapLauncher.launchMapApp(ASMapApp.ASMapAppGoogleMaps, fromDirections: fromMapPoint, toDirection: toMapPoint)
}

目前支持下列地图应用:



  • - Apple Maps


  • - Google Maps


  • - Yandex Navigator


  • - Citymapper


  • - Navigon


  • - The Transit App


  • - Waze


浏览 19
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报