Skip to content

CMMapLauncher is a mini-library for iOS written in Objective-C that makes it quick and easy to show directions in various mapping applications.

License

Notifications You must be signed in to change notification settings

Shebuka/CMMapLauncher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMMapLauncher

CMMapLauncher is a mini-library for iOS written in Objective-C that makes it quick and easy to show directions in various mapping applications.

Requirements

  • Objective-C
  • iOS 9+
  • MapKit Framework

Installation

To use it, just add CMMapLauncher.h and CMMapLauncher.m to your project.

Since iOS 9 to query schemes of installed apps you need to add these entries into your plist :

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>comgooglemaps</string>
    <string>waze</string>
    <string>here-route</string>
    <string>com.sygic.aura</string>
    <string>yandexnavi</string>
    <string>navigon</string>
    <string>uber</string>
    <string>moovit</string>
    <string>citymapper</string>
    <string>transit</string>
</array>

Usage

While the source from/start CMMapPoint is optional and is used only in directions mode, the destination to/end CMMapPoint is always required in both show point and directions modes.

To check whether one of the supported mapping apps is present on the user's device:

BOOL installed = [CMMapLauncher isMapAppInstalled:CMMapAppCitymapper];

Then, to launch into directions in that app:

CLLocationCoordinate2D bigBen = CLLocationCoordinate2DMake(51.500755, -0.124626);

CMMapPoint *mapPoint = [CMMapPoint mapPointWithName:@"Big Ben" coordinate:bigBen];

[CMMapLauncher launchMapApp:CMMapAppCitymapper forDirectionsTo:mapPoint];

Instead of checking all the available apps yourself, you can present an actionSheet with all currently available apps by calling:

[CMMapLauncher showActionSheetWithMapAppOptionsInViewController:self 
                                              fromBarButtonItem:self.navigationItem.rightBarButtonItem 
                                                    forPosition:mapPoint];

Enable debug logging to log the launch URI/parameters:

[CMMapLauncher enableDebugLogging];

Supported apps

CMMapLauncher currently knows how to show directions in the following mapping apps:

Navigation

  • Apple Maps — CMMapAppAppleMaps
  • Google Maps — CMMapAppGoogleMaps
  • Waze — CMMapAppWaze
  • HERE Maps — CMMapAppHereMaps
  • Sygic — CMMapAppSygic
  • Yandex Navigator — CMMapAppYandex
  • Navigon — CMMapAppNavigon

Taxi

  • Uber — CMMapAppUber

Transit

  • Moovit — CMMapAppMoovit
  • Citymapper — CMMapAppCitymapper
  • The Transit App — CMMapAppTheTransitApp

Contributing

If you know of other direction-providing apps that expose a URL scheme for launching from other apps, this project wants to incorporate them!

Pull requests and issues providing URL schemes are encouraged. For major changes, please open an issue first to discuss what you would like to change.

Credits

CMMapLauncher was originally created by Citymapper, but is released under the MIT License for the benefit of the iOS developer community.

License

MIT

About

CMMapLauncher is a mini-library for iOS written in Objective-C that makes it quick and easy to show directions in various mapping applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 98.2%
  • Ruby 1.8%