Localide is an easy helper to offer users a personalized experience by using their favorite installed apps for directions.
Add theLocalide Classes' files to your project, or use CocoaPods:
pod 'Localide', '~> 1.1'
Firstly insert all Third Party Apps' URL schemes to your Info.plist :
LSApplicationQueriesSchemes:
Info.plist should look like this .
let location = CLLocationCoordinate2D(latitude: 37.776692, longitude: 0.0) Localide.sharedManager.promptForDirections(toLocation: location, { (usedApp, fromMemory, openedLinkSuccessfully) in print("The user picked /(usedApp.name)") }
remembePreference
argument. usingASubsetOfApps
argument. 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) }