The library allows in the simplest way to add "Route to any location" functionality to your app. By calling the only one method the library attempt to present an ActionSheet with all supported and installed navigation app on the device.
For now, supporting: Apple Maps, Google Maps, Waze and Yandex.
To play with usage example navigate to MAPLExample folder and look at MAPLExample.xcodeproj
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/syngenta/MapLauncher.git
MapLauncher is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MapLauncher'Add to your project Info.plist next key-value pair:
...
<key>LSApplicationQueriesSchemes</key>
<array>
<string>waze</string>
<string>comgooglemaps</string>
<string>yandexnavi</string>
</array>
...In a place where you are going to implement the functionality you need to import the library:
import MapLauncherAnd call ActionSheet next way:
...
// Desired destination coordinates
let placeLocation = CLLocationCoordinate2D(latitude: 50.4536, longitude: 30.5164)
// Presenting navigation apps ActionSheet
MapLauncher().present(destination: placeLocation, on: self)
// or
MapLauncher().present(
destination: placeLocation,
on: self,
actionSheetTitle: "Build a route using:",
actionSheetMessage: "(you will be redirected to the selected app)"
)
...Dmytro Romanov, dimkahr@gmail.com
MapLauncher is available under the MIT license. See the LICENSE file for more info.
