Localide:个性化选用合适的地图内核做为指路向导

923 阅读1分钟
原文链接: github.com

查看图片

Requierments

Installation

Add the Localide Classes' files to your project, or use CocoaPods:

Usage

Firstly insert all Third Party Apps' URL schemes to your Info.plist:

LSApplicationQueriesSchemes:

Info.plist should look like this.

Giving the user the option to use their favorite installed app
let location = CLLocationCoordinate2D(latitude: 37.776692, longitude: 0.0)
Localide.sharedManager.promptForDirections(toLocation: location,  { (usedApp, fromMemory, openedLinkSuccessfully) in
    print("The user picked \(usedApp.name)")
}
Other Options
  • You may also choose to have Localide remember the user's choice for future directions by using the remembePreference argument.
  • You may also choose to restrict the user from using some applications by using the usingASubsetOfApps argument.
Specific App

You can launch the Apple Maps app with directions to location by using:

let location = CLLocationCoordinate2D(latitude: 37.776692, longitude: 0.0)
Localide.sharedManager.launchNativeAppleMapsAppForDirections(toLocation: location)

For other apps:

if LocalideMapApp.GoogleMaps.canOpenApp() {
    let location = CLLocationCoordinate2D(latitude: 37.776692, longitude: 0.0)
    LocalideMapApp.GoogleMaps.launchAppWithDirections(toLocation: location)
}

Pipeline

  • Support addresses
  • Ask user if they wish to use the same app in the future.