####Localide is an easy helper to offer users a personalized experience by using their favorite installed apps for directions.
- Swift
- iOS 8.0+
- Xcode 7.3
Add the Localide Classes' files to your project, or use CocoaPods:
pod 'Localide', '~> 2.0'
Firstly insert all Third Party Apps' URL schemes to your Info.plist:
LSApplicationQueriesSchemes:
- citymapper (Citymapper App)
- comgooglemaps (Google Maps App)
- navigon (Navigon App)
- transit (Transit App)
- waze (Waze App)
- yandexnavi (Yandex Navigator)
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)")
}
- You may also choose to have Localide remember the user's choice for future directions by using the
rememberPreference
argument. - You may also choose to restrict the user from using some applications by using the
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)
}
- Support addresses
- Ask user if they wish to use the same app in the future.