Below are some of the major components used when building a map-based iOS app with Mapbox:
- Map view (
MGLMapViewclass) - The map view is an interactive world map that pans and zooms in response to gestures. Optionally, use the corresponding
MGLMapViewDelegateprotocol to customize annotations, respond to user interaction, and more.
MGLMapViewDelegatefollows Cocoa's delegation design pattern.
- Annotations (
MGLAnnotationprotocol) - Use an annotation to present data points and custom points of interest atop the map view. The premade
MGLPointAnnotationclass makes it easy to add a basic, pin-like point annotation. Alternatively, have your own model class adopt the
MGLAnnotationprotocol to have the map view serve as a container for your data. Use the
MGLAnnotationViewclass for further visual customization and tight integration with UIKit.
- Style (
MGLStyleprovides access to the runtime styling API, with options for controlling every aspect of the map’s content and appearance in real time. The runtime styling API offers a more powerful alternative to annotations for data visualizations.
- Offline maps (
MGLOfflineStorageclass) - An offline pack makes a region of the map available even when a network connection is unavailable or unreliable. Use the singleton
MGLOfflineStorageobject to download and manage
Full API documentation is available on the web, in the binary download package, or right in Xcode, either inline or in Xcode’s Quick Help inspector.
All Mapbox accounts have access to our professionally-designed template styles. You can also design your own custom styles visually within Mapbox Studio for use with the Mapbox iOS SDK. See our examples for using one of our template styles or a custom style designed in Mapbox Studio.
If your application displays a map using Mapbox map designs or data, you must display the Mapbox wordmark and text attribution. The Mapbox iOS SDK will add attribution to your maps automatically. For more information about required attribution, see our guidelines.
Additional Mapbox libraries
In addition to the Mapbox iOS SDK, we also provide libraries that connect to other Mapbox services using a familiar, object-oriented interface.
The Mapbox Navigation SDK for iOS gives you all the tools you need to add turn-by-turn navigation to your application, powered by MapboxDirections.swift. It works with both Swift and Objective-C on iOS to provide drop-in UI components for navigation while supporting routing profiles for driving, walking, and cycling directions. It also includes features such as maneuver announcements, traffic avoidance, and automatic rerouting. With the Mapbox Navigation SDK for iOS, you can integrate navigation within your own application without having to send your users to a third party navigation service.
MapboxDirections.swift connects your application to the Mapbox Directions API. It is compatible with both Objective-C and Swift on iOS, macOS, tvOS, and watchOS. Quickly get driving, cycling, or walking directions, whether the trip is nonstop or it has multiple stopping points, all using a simple interface reminiscent of MapKit’s
MapboxGeocoder.swift connects your application to the Mapbox Geocoding API. It works with both Swift and Objective-C on iOS, macOS, tvOS, and watchOS. Easily convert an address or place name into a coordinate pair or vice versa, all using a simple interface similar to the Core Location framework’s
CLGeocoder. MapboxGeocoder.swift integrates with both Core Location and the Contacts framework.
MapboxStatic.swift connects your application to the Mapbox Static API. It works with both Swift and Objective-C on iOS, macOS, tvOS, and watchOS. Quickly generate a static map image with markers and other overlays. Static maps are best suited for table views and other space- or memory-constrained environments in which the map doesn’t need to respond to gestures. If the map still needs to work when the device is offline, consider using the Mapbox iOS SDK’s offline map feature instead.