Maps
MGLSettings
                                @interface MGLSettings : NSObjectThe MGLSettings object provides a global way to set SDK properties such as apiKey,
                      backend URL, etc.
Tile Server Configuration
- 
                            tileServerOptionsTile server options DeclarationObjective-C @property (class, copy, nullable) MGLTileServerOptions *tileServerOptions;Swift @NSCopying class var tileServerOptions: MGLTileServerOptions? { get set }
Authorizing Access
- 
                            apiKeyThe API Key used by all instances of MGLMapViewin the current application. Setting this property to a value ofnilhas no effect.Note You must set the API key before attempting to load any style which requires the token. Therefore, you should generally set it before creating an instance ofMGLMapView. The recommended way to set an api key is to add an entry to your application’s Info.plist file with the keyMGLApiKeyand the typeString. Alternatively, you may call this method from your application delegate’s-applicationDidFinishLaunching:method.DeclarationObjective-C @property (class, copy, nullable) NSString *apiKey;Swift class var apiKey: String? { get set }
- 
                            
                            Instructs the SDk to use the give tile server DeclarationObjective-C + (void)useWellKnownTileServer:(MGLWellKnownTileServer)tileServer;Swift class func use(_ tileServer: MGLWellKnownTileServer)
MGLMapCamera
                                        @interface MGLMapCamera : NSObject <NSSecureCoding, NSCopying>An MGLMapCamera object represents a viewpoint from which the user observes
                              some point on an MGLMapView.
#### Related examples
                              See the 
                                Camera animation example to learn how to create a camera that rotates
                              around a central point. See the 
                                Restrict map panning to an area example to learn how to restrict map
                              panning using
                              MGLMapViewDelegate‘s
                              -mapView:shouldChangeFromCamera:toCamera: method.
                            
- 
                                  centerCoordinateCoordinate at the center of the map view. DeclarationObjective-C @property (nonatomic) CLLocationCoordinate2D centerCoordinate;Swift var centerCoordinate: CLLocationCoordinate2D { get set }
- 
                                  headingHeading measured in degrees clockwise from true north. DeclarationObjective-C @property (nonatomic) CLLocationDirection heading;Swift var heading: CLLocationDirection { get set }
- 
                                  pitchPitch toward the horizon measured in degrees, with 0 degrees resulting in a two-dimensional map. DeclarationObjective-C @property (nonatomic) CGFloat pitch;Swift var pitch: CGFloat { get set }
- 
                                  altitudeThe altitude (measured in meters) above the map at which the camera is situated. The altitude is the distance from the viewpoint to the map, perpendicular to the map plane. This property does not account for physical elevation. This property’s value may be less than that of the viewingDistanceproperty. Setting this property automatically updates theviewingDistanceproperty based on thepitchproperty’s current value.DeclarationObjective-C @property (nonatomic) CLLocationDistance altitude;Swift var altitude: CLLocationDistance { get set }
- 
                                  viewingDistanceThe straight-line distance from the viewpoint to the centerCoordinate.Setting this property automatically updates the altitudeproperty based on thepitchproperty’s current value.DeclarationObjective-C @property (nonatomic) CLLocationDistance viewingDistance;Swift var viewingDistance: CLLocationDistance { get set }
- 
                                  cameraReturns a new camera with all properties set to 0. DeclarationObjective-C + (nonnull instancetype)camera;
- 
                                  cameraLookingAtCenterCoordinate:fromEyeCoordinate:eyeAltitude:Returns a new camera based on information about the camera’s viewpoint and focus point. DeclarationObjective-C + (nonnull instancetype) cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate fromEyeCoordinate:(CLLocationCoordinate2D)eyeCoordinate eyeAltitude:(CLLocationDistance)eyeAltitude;Swift convenience init(lookingAtCenter centerCoordinate: CLLocationCoordinate2D, fromEyeCoordinate eyeCoordinate: CLLocationCoordinate2D, eyeAltitude: CLLocationDistance)ParameterscenterCoordinateThe geographic coordinate on which the map should be centered. eyeCoordinateThe geometric coordinate at which the camera should be situated. eyeAltitudeThe altitude (measured in meters) above the map at which the camera should be situated. The altitude may be less than the distance from the camera’s viewpoint to the camera’s focus point. 
- 
                                  cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading:Returns a new camera with the given distance, pitch, and heading. This method interprets the distance as a straight-line distance from the viewpoint to the center coordinate. To specify the altitude of the viewpoint, use the -cameraLookingAtCenterCoordinate:altitude:pitch:heading:method.DeclarationObjective-C + (nonnull instancetype) cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate acrossDistance:(CLLocationDistance)distance pitch:(CGFloat)pitch heading:(CLLocationDirection)heading;Swift convenience init(lookingAtCenter centerCoordinate: CLLocationCoordinate2D, acrossDistance distance: CLLocationDistance, pitch: CGFloat, heading: CLLocationDirection)ParameterscenterCoordinateThe geographic coordinate on which the map should be centered. distanceThe straight-line distance from the viewpoint to the centerCoordinate.pitchThe viewing angle of the camera, measured in degrees. A value of 0results in a camera pointed straight down at the map. Angles greater than0result in a camera angled toward the horizon.headingThe camera’s heading, measured in degrees clockwise from true north. A value of 0means that the top edge of the map view corresponds to true north. The value90means the top of the map is pointing due east. The value180means the top of the map points due south, and so on.
- 
                                  cameraLookingAtCenterCoordinate:altitude:pitch:headingReturns a new camera with the given altitude, pitch, and heading. DeclarationObjective-C + (nonnull instancetype) cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate altitude:(CLLocationDistance)altitude pitch:(CGFloat)pitch heading:(CLLocationDirection)heading;Swift convenience init(lookingAtCenter centerCoordinate: CLLocationCoordinate2D, altitude: CLLocationDistance, pitch: CGFloat, heading: CLLocationDirection)ParameterscenterCoordinateThe geographic coordinate on which the map should be centered. altitudeThe altitude (measured in meters) above the map at which the camera should be situated. The altitude may be less than the distance from the camera’s viewpoint to the camera’s focus point. pitchThe viewing angle of the camera, measured in degrees. A value of 0results in a camera pointed straight down at the map. Angles greater than0result in a camera angled toward the horizon.headingThe camera’s heading, measured in degrees clockwise from true north. A value of 0means that the top edge of the map view corresponds to true north. The value90means the top of the map is pointing due east. The value180means the top of the map points due south, and so on.
- 
                                  cameraLookingAtCenterCoordinate:fromDistance:pitch:headingDeprecated Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:. Note This initializer incorrectly interprets thedistanceparameter. To specify the straight-line distance from the viewpoint tocenterCoordinate, use the-cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading:method. To specify the altitude of the viewpoint, use the-cameraLookingAtCenterCoordinate:altitude:pitch:heading:method, which has the same behavior as this initializer.DeclarationObjective-C + (nonnull instancetype) cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate fromDistance:(CLLocationDistance)distance pitch:(CGFloat)pitch heading:(CLLocationDirection)heading;Swift convenience init(lookingAtCenter centerCoordinate: CLLocationCoordinate2D, fromDistance distance: CLLocationDistance, pitch: CGFloat, heading: CLLocationDirection)
- 
                                  isEqualToMapCamera:Returns a Boolean value indicating whether the given camera is functionally equivalent to the receiver. Unlike -isEqual:, this method returnsYESif the difference between the coordinates, altitudes, pitches, or headings of the two camera objects is negligible.DeclarationObjective-C - (BOOL)isEqualToMapCamera:(nonnull MGLMapCamera *)otherCamera;Swift func isEqual(to otherCamera: MGLMapCamera) -> BoolParametersotherCameraThe camera with which to compare the receiver. Return ValueA Boolean value indicating whether the two cameras are functionally equivalent. 
MGLMapView
                                @interface MGLMapView : UIView <MGLStylable>An interactive, customizable map view with an interface similar to the one provided by Apple’s MapKit.
Using MGLMapView, you can embed the map inside a view, allow users to
                          manipulate it with standard gestures, animate the map between different
                          viewpoints, and present information in the form of annotations and overlays.
The map view loads scalable vector tiles that conform to the Mapbox Vector Tile Specification. It styles them with a style that conforms to the Mapbox Style Specification. Such styles can be designed in Mapbox Studio and hosted on mapbox.com.
A collection of Mapbox-hosted styles is available through the
                          MGLStyle
                          class. These basic styles use
                          Mapbox Streets
                          or Mapbox Satellite data
                          sources, but you can specify a custom style that makes use of your own data.
                        
Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the Mapbox account page. Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission.
Because MGLMapView loads asynchronously, several delegate methods are available
                          for receiving map-related updates. These methods can be used to ensure that certain operations
                          have completed before taking any additional actions. Information on these methods is located
                          in the MGLMapViewDelegate
                          protocol documentation.
                        
Adding your own gesture recognizer to MGLMapView will block the corresponding
                          gesture recognizer built into MGLMapView. To avoid conflicts, define which
                          gesture takes precedence. For example, you can create your own
                          UITapGestureRecognizer that will be invoked only if the default
                          MGLMapView
                          tap gesture fails:
                        
let mapTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(myCustomFunction))
                                for recognizer in mapView.gestureRecognizers! where recognizer is UITapGestureRecognizer {
                                    mapTapGestureRecognizer.require(toFail: recognizer)
                                }
                                mapView.addGestureRecognizer(mapTapGestureRecognizer)
                                Note
You are responsible for getting permission to use the map data and for ensuring that your use adheres to the relevant terms of use.Related examples
See the 
                            Simple map view example to learn how to initialize a basic MGLMapView.
Creating Instances
- 
                                initWithFrameInitializes and returns a newly allocated map view with the specified frame and the default style. DeclarationObjective-C - (nonnull instancetype)initWithFrame:(CGRect)frame;Swift init(frame: CGRect)ParametersframeThe frame for the view, measured in points. Return ValueAn initialized map view. 
- 
                                initWithFrame:styleURL:Initializes and returns a newly allocated map view with the specified frame and style URL. Related examplesSee the Apply a style designed in Mapbox Studio example to learn how to initialize an MGLMapViewwith a custom style. See the Apply a style designed in Mapbox Studio Classic example to learn how to intialize anMGLMapViewwith a Studio Classic style or a custom style JSON. See the Use third-party vector tiles example to learn how to initialize anMGLMapViewwith a third-party tile source.DeclarationObjective-C - (nonnull instancetype)initWithFrame:(CGRect)frame styleURL:(nullable NSURL *)styleURL;Swift init(frame: CGRect, styleURL: URL?)ParametersframeThe frame for the view, measured in points. styleURLURL of the map style to display. The URL may be a full HTTP or HTTPS URL, a canonical URL or a path to a local file relative to the application’s resource path. Specify nilfor the default style.Return ValueAn initialized map view. 
Accessing the Delegate
- 
                                delegateThe receiver’s delegate. A map view sends messages to its delegate to notify it of changes to its contents or the viewpoint. The delegate also provides information about annotations displayed on the map, such as the styles to apply to individual annotations. DeclarationObjective-C @property (nonatomic, weak, nullable) id<MGLMapViewDelegate> delegate;
Configuring the Map’s Appearance
- 
                                styleThe style currently displayed in the receiver. Unlike the styleURLproperty, this property is set to an object that allows you to manipulate every aspect of the style locally.If the style is loading, this property is set to niluntil the style finishes loading. If the style has failed to load, this property is set tonil. Because the style loads asynchronously, you should manipulate it in the-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]or-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]method. It is not possible to manipulate the style before it has finished loading.Note The default styles provided by Mapbox contain sources and layers with identifiers that will change over time. Applications that use APIs that manipulate a style’s sources and layers must first set the style URL to an explicitly versioned style using a convenience method like+[MGLStyle outdoorsStyleURLWithVersion:],MGLMapView’s “Style URL” inspectable in Interface Builder, or a manually constructedNSURL.
- 
                                styleURLURL of the style currently displayed in the receiver. The URL may be a full HTTP or HTTPS URL, canonical URL, or a path to a local file relative to the application’s resource path. If you set this property to nil, the receiver will use the default style and this property will automatically be set to that style’s URL.If you want to modify the current style without replacing it outright, or if you want to introspect individual style attributes, use the styleproperty.Related examplesSee the Switch between map styles example to learn how to change the style of a map at runtime. DeclarationObjective-C @property (nonatomic, null_resettable) NSURL *styleURL;Swift var styleURL: URL! { get set }
- 
                                -reloadStyle:Reloads the style. You do not normally need to call this method. The map view automatically responds to changes in network connectivity by reloading the style. You may need to call this method if you change the access token after a style has loaded but before loading a style associated with a different Mapbox account. This method does not bust the cache. Even if the style has recently changed on the server, calling this method does not necessarily ensure that the map view reflects those changes. DeclarationObjective-C - (void)reloadStyle:(nullable id)sender;Swift @IBAction func reloadStyle(_ sender: Any?)
- 
                                automaticallyAdjustsContentInsetA boolean value that indicates if whether the map view should automatically adjust its content insets. When this property is set to YESthe map automatically updates itscontentInsetproperty to account for any area not covered by navigation bars, tab bars, toolbars, and other ancestors that obscure the map view.DeclarationObjective-C @property BOOL automaticallyAdjustsContentInset;Swift var automaticallyAdjustsContentInset: Bool { get set }
- 
                                showsScaleA Boolean value indicating whether the map may display scale information. The scale bar may not be shown at all zoom levels. The scale bar becomes visible when the maximum distance visible on the map view is less than 400 miles (800 kilometers). The zoom level where this occurs depends on the latitude at the map view’s center coordinate, as well as the device screen width. At latitudes farther from the equator, the scale bar becomes visible at lower zoom levels. The unit of measurement is determined by the user’s device locale. The view controlled by this property is available at scaleBar. The default value of this property isNO.DeclarationObjective-C @property (nonatomic) BOOL showsScale;Swift var showsScale: Bool { get set }
- 
                                scaleBarA control indicating the scale of the map. The scale bar is positioned in the upper-left corner. Enable the scale bar via showsScale.DeclarationObjective-C @property (nonatomic, readonly) UIView *_Nonnull scaleBar;Swift var scaleBar: UIView { get }
- 
                                scaleBarShouldShowDarkStylesSets whether the scale uses styles that make it easier to read on a dark styled map DeclarationObjective-C @property (nonatomic) BOOL scaleBarShouldShowDarkStyles;Swift var scaleBarShouldShowDarkStyles: Bool { get set }
- 
                                scaleBarUsesMetricSystemSets whether the scale uses metric DeclarationObjective-C @property (nonatomic) BOOL scaleBarUsesMetricSystem;Swift var scaleBarUsesMetricSystem: Bool { get set }
- 
                                scaleBarPositionThe position of the scale bar. The default value is MGLOrnamentPositionTopLeft.DeclarationObjective-C @property (nonatomic) MGLOrnamentPosition scaleBarPosition;Swift var scaleBarPosition: MGLOrnamentPosition { get set }
- 
                                scaleBarMarginsA CGPointindicating the position offset of the scale bar.DeclarationObjective-C @property (nonatomic) CGPoint scaleBarMargins;Swift var scaleBarMargins: CGPoint { get set }
- 
                                compassViewA control indicating the map’s direction and allowing the user to manipulate the direction, positioned in the upper-right corner. DeclarationObjective-C @property (nonatomic, readonly) MGLCompassButton *_Nonnull compassView;Swift var compassView: MGLCompassButton { get }
- 
                                compassViewPositionThe position of the compass view. The default value is MGLOrnamentPositionTopRight.DeclarationObjective-C @property (nonatomic) MGLOrnamentPosition compassViewPosition;Swift var compassViewPosition: MGLOrnamentPosition { get set }
- 
                                compassViewMarginsA CGPointindicating the position offset of the compass.DeclarationObjective-C @property (nonatomic) CGPoint compassViewMargins;Swift var compassViewMargins: CGPoint { get set }
- 
                                logoViewThe Mapbox wordmark, positioned in the lower-left corner. Note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, requires most Mapbox customers to display the Mapbox wordmark. If this applies to you, do not hide this view or change its contents.DeclarationObjective-C @property (nonatomic, readonly) UIImageView *_Nonnull logoView;Swift var logoView: UIImageView { get }
- 
                                logoViewPositionThe position of the logo view. The default value is MGLOrnamentPositionBottomLeft.DeclarationObjective-C @property (nonatomic) MGLOrnamentPosition logoViewPosition;Swift var logoViewPosition: MGLOrnamentPosition { get set }
- 
                                logoViewMarginsA CGPointindicating the position offset of the logo.DeclarationObjective-C @property (nonatomic) CGPoint logoViewMargins;Swift var logoViewMargins: CGPoint { get set }
- 
                                attributionButtonA view showing legally required copyright notices, positioned at the bottom-right of the map view. If you choose to reimplement this view, assign the -showAttribution:method as the action for your view to present the default notices and settings.Note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data. If that applies to this map view, do not hide this view or remove any notices from it.DeclarationObjective-C @property (nonatomic, readonly) UIButton *_Nonnull attributionButton;Swift var attributionButton: UIButton { get }
- 
                                attributionButtonPositionThe position of the attribution button. The default value is MGLOrnamentPositionBottomRight.DeclarationObjective-C @property (nonatomic) MGLOrnamentPosition attributionButtonPosition;Swift var attributionButtonPosition: MGLOrnamentPosition { get set }
- 
                                attributionButtonMarginsA CGPointindicating the position offset of the attribution.DeclarationObjective-C @property (nonatomic) CGPoint attributionButtonMargins;Swift var attributionButtonMargins: CGPoint { get set }
- 
                                -showAttribution:Show the attribution action sheet. This action is performed when the user taps on the attribution button provided by default via the attributionButtonproperty. If you implement a custom attribution button, you should add this action to the button.DeclarationObjective-C - (void)showAttribution:(nonnull id)sender;Swift @IBAction func showAttribution(_ sender: Any)
- 
                                preferredFramesPerSecondThe preferred frame rate at which the map view is rendered. The default value for this property is MGLMapViewPreferredFramesPerSecondDefault, which will adaptively set the preferred frame rate based on the capability of the user’s device to maintain a smooth experience.In addition to the provided MGLMapViewPreferredFramesPerSecondoptions, this property can be set to arbitrary integer values.See CADisplayLink.preferredFramesPerSecondDeclarationObjective-C @property (nonatomic) MGLMapViewPreferredFramesPerSecond preferredFramesPerSecond;Swift var preferredFramesPerSecond: MGLMapViewPreferredFramesPerSecond { get set }
- 
                                prefetchesTilesA Boolean value indicating whether the map should prefetch tiles. When this property is set to YES, the map view prefetches tiles designed for a low zoom level and displays them until receiving more detailed tiles for the current zoom level. The prefetched tiles typically contain simplified versions of each shape, improving the map view’s perceived performance.The default value of this property is YES.DeclarationObjective-C @property (nonatomic) BOOL prefetchesTiles;Swift var prefetchesTiles: Bool { get set }
Displaying the User’s Location
- 
                                locationManagerThe object that this map view uses to start and stop the delivery of location-related updates. To receive the current user location, implement the -[MGLMapViewDelegate mapView:didUpdateUserLocation:]and-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]methods.If setting this property to nilor if no custom manager is provided this property is set to the default location manager.MGLMapViewuses a default location manager. If you want to substitute your own location manager, you should do so by setting this property before settingshowsUserLocationtoYES. To restore the default location manager, set this property tonil.DeclarationObjective-C @property (nonatomic, null_resettable) id<MGLLocationManager> locationManager;
- 
                                showsUserLocationA Boolean value indicating whether the map may display the user location. Setting this property to YEScauses the map view to use the Core Location framework to find the current location. As long as this property isYES, the map view continues to track the user’s location and update it periodically.This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisibleproperty. The default value of this property isNO.Your app must specify a value for NSLocationWhenInUseUsageDescriptionorNSLocationAlwaysUsageDescriptionin itsInfo.plistto satisfy the requirements of the underlying Core Location framework when enabling this property.If you implement a custom location manager, set the locationManagerbefore callingshowsUserLocation.DeclarationObjective-C @property (nonatomic) BOOL showsUserLocation;Swift var showsUserLocation: Bool { get set }
- 
                                userLocationVisibleA Boolean value indicating whether the device’s current location is visible in the map view. Use showsUserLocationto control the visibility of the on-screen user location annotation.DeclarationObjective-C @property (nonatomic, assign, unsafe_unretained, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;Swift var isUserLocationVisible: Bool { get }
- 
                                userLocationReturns the annotation object indicating the user’s current location. DeclarationObjective-C @property (nonatomic, readonly, nullable) MGLUserLocation *userLocation;Swift var userLocation: MGLUserLocation? { get }
- 
                                userTrackingModeThe mode used to track the user location. The default value is MGLUserTrackingModeNone.Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the -setUserTrackingMode:animated:method instead.Related examplesSee the Customize the user location annotation to learn how to customize the default user location annotation shown by MGLUserTrackingMode.DeclarationObjective-C @property (nonatomic) MGLUserTrackingMode userTrackingMode;Swift var userTrackingMode: MGLUserTrackingMode { get set }
- 
                                -setUserTrackingMode:animated:Deprecated Use -setUserTrackingMode:animated:completionHandler:instead.Deprecated. Sets the mode used to track the user location, with an optional transition. To specify a completion handler to execute after the animation finishes, use the -setUserTrackingMode:animated:completionHandler:method.DeclarationObjective-C - (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated;Swift func setUserTrackingMode(_ mode: MGLUserTrackingMode, animated: Bool)ParametersmodeThe mode used to track the user location. animatedIf YES, there is an animated transition from the current viewport to a viewport that results from the change tomode. IfNO, the map view instantaneously changes to the new viewport. This parameter only affects the initial transition; subsequent changes to the user location or heading are always animated.
- 
                                -setUserTrackingMode:animated:completionHandler:Sets the mode used to track the user location, with an optional transition and completion handler. DeclarationObjective-C - (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;Swift func setUserTrackingMode(_ mode: MGLUserTrackingMode, animated: Bool) asyncParametersmodeThe mode used to track the user location. animatedIf YES, there is an animated transition from the current viewport to a viewport that results from the change tomode. IfNO, the map view instantaneously changes to the new viewport. This parameter only affects the initial transition; subsequent changes to the user location or heading are always animated.completionThe block executed after the animation finishes. 
- 
                                userLocationVerticalAlignmentDeprecated Use -[MGLMapViewDelegate mapViewUserLocationAnchorPoint:]instead.The vertical alignment of the user location annotation within the receiver. The default value is MGLAnnotationVerticalAlignmentCenter.Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the -setUserLocationVerticalAlignment:animated:method instead.DeclarationObjective-C @property (nonatomic) MGLAnnotationVerticalAlignment userLocationVerticalAlignment;Swift var userLocationVerticalAlignment: MGLAnnotationVerticalAlignment { get set }
- 
                                -setUserLocationVerticalAlignment:animated:Deprecated Use -[MGLMapViewDelegate mapViewUserLocationAnchorPoint:]instead.Sets the vertical alignment of the user location annotation within the receiver, with an optional transition. DeclarationObjective-C - (void)setUserLocationVerticalAlignment: (MGLAnnotationVerticalAlignment)alignment animated:(BOOL)animated;Swift func setUserLocationVerticalAlignment(_ alignment: MGLAnnotationVerticalAlignment, animated: Bool)ParametersalignmentThe vertical alignment of the user location annotation. animatedIf YES, the user location annotation animates to its new position within the map view. IfNO, the user location annotation instantaneously moves to its new position.
- 
                                -updateUserLocationAnnotationViewUpdates the position of the user location annotation view by retreiving the user’s last known location. DeclarationObjective-C - (void)updateUserLocationAnnotationView;Swift func updateUserLocationAnnotationView()
- 
                                -updateUserLocationAnnotationViewAnimatedWithDuration:Updates the position of the user location annotation view by retreiving the user’s last known location with a specified duration. DeclarationObjective-C - (void)updateUserLocationAnnotationViewAnimatedWithDuration: (NSTimeInterval)duration;Swift func updateUserLocationAnnotationViewAnimated(withDuration duration: TimeInterval)ParametersdurationThe duration to animate the change in seconds. 
- 
                                showsUserHeadingIndicatorA Boolean value indicating whether the user location annotation may display a permanent heading indicator. Setting this property to YEScauses the default user location annotation to appear and always show an arrow-shaped heading indicator, if heading is available. This property does not rotate the map; for that, seeMGLUserTrackingModeFollowWithHeading.This property has no effect when userTrackingModeisMGLUserTrackingModeFollowWithHeadingorMGLUserTrackingModeFollowWithCourse.The default value of this property is NO.DeclarationObjective-C @property (nonatomic) BOOL showsUserHeadingIndicator;Swift var showsUserHeadingIndicator: Bool { get set }
- 
                                displayHeadingCalibrationWhether the map view should display a heading calibration alert when necessary. The default value is YES.DeclarationObjective-C @property (nonatomic) BOOL displayHeadingCalibration;Swift var displayHeadingCalibration: Bool { get set }
- 
                                targetCoordinateThe geographic coordinate that is the subject of observation as the user location is being tracked. By default, this property is set to an invalid coordinate, indicating that there is no target. In course tracking mode, the target forms one of two foci in the viewport, the other being the user location annotation. Typically, this property is set to a destination or waypoint in a real-time navigation scene. As the user annotation moves toward the target, the map automatically zooms in to fit both foci optimally within the viewport. This property has no effect if the userTrackingModeproperty is set to a value other thanMGLUserTrackingModeFollowWithCourse.Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the -setTargetCoordinate:animated:method instead.DeclarationObjective-C @property (nonatomic) CLLocationCoordinate2D targetCoordinate;Swift var targetCoordinate: CLLocationCoordinate2D { get set }
- 
                                -setTargetCoordinate:animated:Deprecated Use -setTargetCoordinate:animated:completionHandler:instead.Deprecated. Sets the geographic coordinate that is the subject of observation as the user location is being tracked, with an optional transition animation. By default, the target coordinate is set to an invalid coordinate, indicating that there is no target. In course tracking mode, the target forms one of two foci in the viewport, the other being the user location annotation. Typically, the target is set to a destination or waypoint in a real-time navigation scene. As the user annotation moves toward the target, the map automatically zooms in to fit both foci optimally within the viewport. This method has no effect if the userTrackingModeproperty is set to a value other thanMGLUserTrackingModeFollowWithCourse.To specify a completion handler to execute after the animation finishes, use the -setTargetCoordinate:animated:completionHandler:method.DeclarationObjective-C - (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate animated:(BOOL)animated;Swift func setTargetCoordinate(_ targetCoordinate: CLLocationCoordinate2D, animated: Bool)ParameterstargetCoordinateThe target coordinate to fit within the viewport. animatedIf YES, the map animates to fit the target within the map view. IfNO, the map fits the target instantaneously.
- 
                                -setTargetCoordinate:animated:completionHandler:Sets the geographic coordinate that is the subject of observation as the user location is being tracked, with an optional transition animation and completion handler. By default, the target coordinate is set to an invalid coordinate, indicating that there is no target. In course tracking mode, the target forms one of two foci in the viewport, the other being the user location annotation. Typically, the target is set to a destination or waypoint in a real-time navigation scene. As the user annotation moves toward the target, the map automatically zooms in to fit both foci optimally within the viewport. This method has no effect if the userTrackingModeproperty is set to a value other thanMGLUserTrackingModeFollowWithCourse.DeclarationObjective-C - (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;Swift func setTargetCoordinate(_ targetCoordinate: CLLocationCoordinate2D, animated: Bool) asyncParameterstargetCoordinateThe target coordinate to fit within the viewport. animatedIf YES, the map animates to fit the target within the map view. IfNO, the map fits the target instantaneously.completionThe block executed after the animation finishes. 
Configuring How the User Interacts with the Map
- 
                                zoomEnabledA Boolean value that determines whether the user may zoom the map in and out, changing the zoom level. When this property is set to YES, the default, the user may zoom the map in and out by pinching two fingers or by double tapping, holding, and moving the finger up and down.This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the map zoom programmatically.DeclarationObjective-C @property (nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;Swift var isZoomEnabled: Bool { get set }
- 
                                scrollEnabledA Boolean value that determines whether the user may scroll around the map, changing the center coordinate. When this property is set to YES, the default, the user may scroll the map by dragging or swiping with one finger.This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the map location programmatically.DeclarationObjective-C @property (nonatomic, assign, unsafe_unretained, readwrite, getter=isScrollEnabled) BOOL scrollEnabled;Swift var isScrollEnabled: Bool { get set }
- 
                                panScrollingModeThe scrolling mode the user is allowed to use to interact with the map. MGLPanScrollingModeHorizontalonly allows the user to scroll horizontally on the map, restricting a user’s ability to scroll vertically.MGLPanScrollingModeVerticalonly allows the user to scroll vertically on the map, restricting a user’s ability to scroll horizontally.MGLPanScrollingModeDefaultallows the user to scroll both horizontally and vertically on the map.By default, this property is set to MGLPanScrollingModeDefault.DeclarationObjective-C @property (nonatomic) MGLPanScrollingMode panScrollingMode;Swift var panScrollingMode: MGLPanScrollingMode { get set }
- 
                                rotateEnabledA Boolean value that determines whether the user may rotate the map, changing the direction. When this property is set to YES, the default, the user may rotate the map by moving two fingers in a circular motion.This property controls only user interactions with the map. If you set the value of this property to NO, you may still rotate the map programmatically.DeclarationObjective-C @property (nonatomic, assign, unsafe_unretained, readwrite, getter=isRotateEnabled) BOOL rotateEnabled;Swift var isRotateEnabled: Bool { get set }
- 
                                pitchEnabledA Boolean value that determines whether the user may change the pitch (tilt) of the map. When this property is set to YES, the default, the user may tilt the map by vertically dragging two fingers.This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the pitch of the map programmatically.The default value of this property is YES.DeclarationObjective-C @property (nonatomic, assign, unsafe_unretained, readwrite, getter=isPitchEnabled) BOOL pitchEnabled;Swift var isPitchEnabled: Bool { get set }
- 
                                anchorRotateOrZoomGesturesToCenterCoordinateA Boolean value that determines whether gestures are anchored to the center coordinate of the map while rotating or zooming. Default value is set to NO. DeclarationObjective-C @property (nonatomic) BOOL anchorRotateOrZoomGesturesToCenterCoordinate;Swift var anchorRotateOrZoomGesturesToCenterCoordinate: Bool { get set }
- 
                                hapticFeedbackEnabledA Boolean value that determines whether the user will receive haptic feedback for certain interactions with the map. When this property is set to YES, the default, aUIImpactFeedbackStyleLighthaptic feedback event be played when the user rotates the map to due north (0°).This feature requires a device that supports haptic feedback, running iOS 10 or newer. DeclarationObjective-C @property (nonatomic, assign, unsafe_unretained, readwrite, getter=isHapticFeedbackEnabled) BOOL hapticFeedbackEnabled;Swift var isHapticFeedbackEnabled: Bool { get set }
- 
                                decelerationRateA floating-point value that determines the rate of deceleration after the user lifts their finger. Your application can use the MGLMapViewDecelerationRateNormalandMGLMapViewDecelerationRateFastconstants as reference points for reasonable deceleration rates.MGLMapViewDecelerationRateImmediatecan be used to disable deceleration entirely.DeclarationObjective-C @property (nonatomic) CGFloat decelerationRate;Swift var decelerationRate: CGFloat { get set }
Manipulating the Viewpoint
- 
                                centerCoordinateThe geographic coordinate at the center of the map view. Changing the value of this property centers the map on the new coordinate without changing the current zoom level. Changing the value of this property updates the map view immediately. If you want to animate the change, use the -setCenterCoordinate:animated:method instead.DeclarationObjective-C @property (nonatomic) CLLocationCoordinate2D centerCoordinate;Swift var centerCoordinate: CLLocationCoordinate2D { get set }
- 
                                -setCenterCoordinate:animated:Changes the center coordinate of the map and optionally animates the change. Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. For animated changes, wait until the map view has finished loading before calling this method. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification.DeclarationObjective-C - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;Swift func setCenter(_ coordinate: CLLocationCoordinate2D, animated: Bool)ParameterscoordinateThe new center coordinate for the map. animatedSpecify YESif you want the map view to scroll to the new location orNOif you want the map to display the new location immediately.
- 
                                -setCenterCoordinate:zoomLevel:animated:Changes the center coordinate and zoom level of the map and optionally animates the change. For animated changes, wait until the map view has finished loading before calling this method. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification.DeclarationObjective-C - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated;Swift func setCenter(_ centerCoordinate: CLLocationCoordinate2D, zoomLevel: Double, animated: Bool)ParameterscenterCoordinateThe new center coordinate for the map. zoomLevelThe new zoom level for the map. animatedSpecify YESif you want the map view to animate scrolling and zooming to the new location orNOif you want the map to display the new location immediately.
- 
                                setCenterCoordinate:zoomLevel:direction:animated:Changes the center coordinate, zoom level, and direction of the map and optionally animates the change. For animated changes, wait until the map view has finished loading before calling this method. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification.DeclarationObjective-C - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated;Swift func setCenter(_ centerCoordinate: CLLocationCoordinate2D, zoomLevel: Double, direction: CLLocationDirection, animated: Bool)ParameterscenterCoordinateThe new center coordinate for the map. zoomLevelThe new zoom level for the map. directionThe new direction for the map, measured in degrees relative to true north. A negative value leaves the map’s direction unchanged. animatedSpecify YESif you want the map view to animate scrolling, zooming, and rotating to the new location orNOif you want the map to display the new location immediately.
- 
                                -setCenterCoordinate:zoomLevel:direction:animated:completionHandler:Changes the center coordinate, zoom level, and direction of the map, calling a completion handler at the end of an optional animation. For animated changes, wait until the map view has finished loading before calling this method. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification.DeclarationObjective-C - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;Swift func setCenter(_ centerCoordinate: CLLocationCoordinate2D, zoomLevel: Double, direction: CLLocationDirection, animated: Bool) asyncParameterscenterCoordinateThe new center coordinate for the map. zoomLevelThe new zoom level for the map. directionThe new direction for the map, measured in degrees relative to true north. A negative value leaves the map’s direction unchanged. animatedSpecify YESif you want the map view to animate scrolling, zooming, and rotating to the new location orNOif you want the map to display the new location immediately.completionThe block executed after the animation finishes. 
- 
                                zoomLevelThe zoom level of the receiver. In addition to affecting the visual size and detail of features on the map, the zoom level affects the size of the vector tiles that are loaded. At zoom level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ of the world; at zoom level 2, 1⁄16 of the world, and so on. Changing the value of this property updates the map view immediately. If you want to animate the change, use the -setZoomLevel:animated:method instead.DeclarationObjective-C @property (nonatomic) double zoomLevel;Swift var zoomLevel: Double { get set }
- 
                                -setZoomLevel:animated:Changes the zoom level of the map and optionally animates the change. Changing the zoom level scales the map without changing the current center coordinate. DeclarationObjective-C - (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated;Swift func setZoomLevel(_ zoomLevel: Double, animated: Bool)ParameterszoomLevelThe new zoom level for the map. animatedSpecify YESif you want the map view to animate the change to the new zoom level orNOif you want the map to display the new zoom level immediately.
- 
                                minimumZoomLevelThe minimum zoom level at which the map can be shown. Depending on the map view’s aspect ratio, the map view may be prevented from reaching the minimum zoom level, in order to keep the map from repeating within the current viewport. If the value of this property is greater than that of the maximumZoomLevel property, the behavior is undefined. The default minimumZoomLevel is 0. DeclarationObjective-C @property (nonatomic) double minimumZoomLevel;Swift var minimumZoomLevel: Double { get set }
- 
                                maximumZoomLevelThe maximum zoom level the map can be shown at. If the value of this property is smaller than that of the minimumZoomLevel property, the behavior is undefined. The default maximumZoomLevel is 22. The upper bound for this property is 25.5. DeclarationObjective-C @property (nonatomic) double maximumZoomLevel;Swift var maximumZoomLevel: Double { get set }
- 
                                directionThe heading of the map, measured in degrees clockwise from true north. The value 0means that the top edge of the map view corresponds to true north. The value90means the top of the map is pointing due east. The value180means the top of the map points due south, and so on.Changing the value of this property updates the map view immediately. If you want to animate the change, use the -setDirection:animated:method instead.DeclarationObjective-C @property (nonatomic) CLLocationDirection direction;Swift var direction: CLLocationDirection { get set }
- 
                                -setDirection:animated:Changes the heading of the map and optionally animates the change. Changing the heading rotates the map without changing the current center coordinate or zoom level. DeclarationObjective-C - (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated;Swift func setDirection(_ direction: CLLocationDirection, animated: Bool)ParametersdirectionThe heading of the map, measured in degrees clockwise from true north. animatedSpecify YESif you want the map view to animate the change to the new heading orNOif you want the map to display the new heading immediately.
- 
                                minimumPitchThe minimum pitch of the map’s camera toward the horizon measured in degrees. If the value of this property is greater than that of the maximumPitchproperty, the behavior is undefined. The pitch may not be less than 0 regardless of this property.The default value of this property is 0 degrees, allowing the map to appear two-dimensional. DeclarationObjective-C @property (nonatomic) CGFloat minimumPitch;Swift var minimumPitch: CGFloat { get set }
- 
                                maximumPitchThe maximum pitch of the map’s camera toward the horizon measured in degrees. If the value of this property is smaller than that of the minimumPitchproperty, the behavior is undefined. The pitch may not exceed 60 degrees regardless of this property.The default value of this property is 60 degrees. DeclarationObjective-C @property (nonatomic) CGFloat maximumPitch;Swift var maximumPitch: CGFloat { get set }
- 
                                -resetNorthResets the map rotation to a northern heading — a directionof0degrees.DeclarationObjective-C - (void)resetNorth;Swift @IBAction func resetNorth()
- 
                                -resetPositionResets the map to the current style’s default viewport. If the style doesn’t specify a default viewport, the map resets to a minimum zoom level, a center coordinate of (0, 0), and a northern heading. DeclarationObjective-C - (void)resetPosition;Swift @IBAction func resetPosition()
- 
                                visibleCoordinateBoundsThe coordinate bounds visible in the receiver’s viewport. Changing the value of this property updates the receiver immediately. If you want to animate the change, call -setVisibleCoordinateBounds:animated:instead.If a longitude is less than −180 degrees or greater than 180 degrees, the visible bounds straddles the antimeridian or international date line. For example, if both Tokyo and San Francisco are visible, the visible bounds might extend from (35.68476, −220.24257) to (37.78428, −122.41310). DeclarationObjective-C @property (nonatomic) MGLCoordinateBounds visibleCoordinateBounds;Swift var visibleCoordinateBounds: MGLCoordinateBounds { get set }
- 
                                -setVisibleCoordinateBounds:animated:Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). DeclarationObjective-C - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated;Swift func setVisibleCoordinateBounds(_ bounds: MGLCoordinateBounds, animated: Bool)ParametersboundsThe bounds that the viewport will show in its entirety. animatedSpecify YESto animate the change by smoothly scrolling and zooming orNOto immediately display the given bounds.
- 
                                -setVisibleCoordinateBounds:edgePadding:animated:Deprecated Use -setVisibleCoordinateBounds:edgePadding:animated:completionHandler:instead.Deprecated. Changes the receiver’s viewport to fit the given coordinate bounds with some additional padding on each side. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). To specify a completion handler to execute after the animation finishes, use the -setVisibleCoordinateBounds:edgePadding:animated:completionHandler:method.DeclarationObjective-C - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;Swift func setVisibleCoordinateBounds(_ bounds: MGLCoordinateBounds, edgePadding insets: UIEdgeInsets, animated: Bool)ParametersboundsThe bounds that the viewport will show in its entirety. insetsThe minimum padding (in screen points) that will be visible around the given coordinate bounds. animatedSpecify YESto animate the change by smoothly scrolling and zooming orNOto immediately display the given bounds.
- 
                                -setVisibleCoordinateBounds:edgePadding:animated:completionHandler:Changes the receiver’s viewport to fit the given coordinate bounds with some additional padding on each side, optionally calling a completion handler. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). DeclarationObjective-C - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;Swift func setVisibleCoordinateBounds(_ bounds: MGLCoordinateBounds, edgePadding insets: UIEdgeInsets, animated: Bool) asyncParametersboundsThe bounds that the viewport will show in its entirety. insetsThe minimum padding (in screen points) that will be visible around the given coordinate bounds. animatedSpecify YESto animate the change by smoothly scrolling and zooming orNOto immediately display the given bounds.completionThe block executed after the animation finishes. 
- 
                                -setVisibleCoordinates:count:edgePadding:animated:Changes the receiver’s viewport to fit all of the given coordinates with some additional padding on each side. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible coordinates to (35.68476, −220.24257) and (37.78428, −122.41310). DeclarationObjective-C - (void)setVisibleCoordinates: (nonnull const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;Swift func setVisibleCoordinates(_ coordinates: UnsafePointer<CLLocationCoordinate2D>, count: UInt, edgePadding insets: UIEdgeInsets, animated: Bool)ParameterscoordinatesThe coordinates that the viewport will show. countThe number of coordinates. This number must not be greater than the number of elements in coordinates.insetsThe minimum padding (in screen points) that will be visible around the given coordinate bounds. animatedSpecify YESto animate the change by smoothly scrolling and zooming orNOto immediately display the given bounds.
- 
                                -setVisibleCoordinates:count:edgePadding:direction:duration:animationTimingFunction:completionHandler:Changes the receiver’s viewport to fit all of the given coordinates with some additional padding on each side, optionally calling a completion handler. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible coordinates to (35.68476, −220.24257) and (37.78428, −122.41310). DeclarationObjective-C - (void)setVisibleCoordinates: (nonnull const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;Swift func setVisibleCoordinates(_ coordinates: UnsafePointer<CLLocationCoordinate2D>, count: UInt, edgePadding insets: UIEdgeInsets, direction: CLLocationDirection, duration: TimeInterval, animationTimingFunction function: CAMediaTimingFunction?) asyncParameterscoordinatesThe coordinates that the viewport will show. countThe number of coordinates. This number must not be greater than the number of elements in coordinates.insetsThe minimum padding (in screen points) that will be visible around the given coordinate bounds. directionThe direction to rotate the map to, measured in degrees relative to true north. A negative value leaves the map’s direction unchanged. durationThe duration to animate the change in seconds. functionThe timing function to animate the change. completionThe block executed after the animation finishes. 
- 
                                -showAnnotations:animated:Sets the visible region so that the map displays the specified annotations. Calling this method updates the value in the visibleCoordinateBoundsproperty and potentially other properties to reflect the new map region. A small amount of padding is reserved around the edges of the map view. To specify a different amount of padding, use the-showAnnotations:edgePadding:animated:method.DeclarationObjective-C - (void)showAnnotations:(nonnull NSArray<id<MGLAnnotation>> *)annotations animated:(BOOL)animated;ParametersannotationsThe annotations that you want to be visible in the map. animatedYESif you want the map region change to be animated, orNOif you want the map to display the new region immediately without animations.
- 
                                -showAnnotations:edgePadding:animated:Deprecated Use -showAnnotations:edgePadding:animated:completionHandler:instead.Deprecated. Sets the visible region so that the map displays the specified annotations with the specified amount of padding on each side. Calling this method updates the value in the visibleCoordinateBoundsproperty and potentially other properties to reflect the new map region.To specify a completion handler to execute after the animation finishes, use the -showAnnotations:edgePadding:animated:completionHandler:method.DeclarationObjective-C - (void)showAnnotations:(nonnull NSArray<id<MGLAnnotation>> *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;ParametersannotationsThe annotations that you want to be visible in the map. insetsThe minimum padding (in screen points) around the edges of the map view to keep clear of annotations. animatedYESif you want the map region change to be animated, orNOif you want the map to display the new region immediately without animations.
- 
                                -showAnnotations:edgePadding:animated:completionHandler:Sets the visible region so that the map displays the specified annotations with the specified amount of padding on each side and an optional completion handler. Calling this method updates the value in the visibleCoordinateBoundsproperty and potentially other properties to reflect the new map region.DeclarationObjective-C - (void)showAnnotations:(nonnull NSArray<id<MGLAnnotation>> *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;ParametersannotationsThe annotations that you want to be visible in the map. insetsThe minimum padding (in screen points) around the edges of the map view to keep clear of annotations. animatedYESif you want the map region change to be animated, orNOif you want the map to display the new region immediately without animations.completionThe block executed after the animation finishes. 
- 
                                cameraA camera representing the current viewpoint of the map. DeclarationObjective-C @property (nonatomic, copy) MGLMapCamera *_Nonnull camera;Swift @NSCopying var camera: MGLMapCamera { get set }
- 
                                -setCamera:animated:Moves the viewpoint to a different location with respect to the map with an optional transition animation. For animated changes, wait until the map view has finished loading before calling this method. Related examplesSee the Camera animation example to learn how to trigger an animation that rotates around a central point. DeclarationObjective-C - (void)setCamera:(nonnull MGLMapCamera *)camera animated:(BOOL)animated;Swift func setCamera(_ camera: MGLMapCamera, animated: Bool)ParameterscameraThe new viewpoint. animatedSpecify YESif you want the map view to animate the change to the new viewpoint orNOif you want the map to display the new viewpoint immediately.
- 
                                -setCamera:withDuration:animationTimingFunction:Moves the viewpoint to a different location with respect to the map with an optional transition duration and timing function. For animated changes, wait until the map view has finished loading before calling this method. Related examplesSee the Camera animation example to learn how to create a timed animation that rotates around a central point for a specific duration. DeclarationObjective-C - (void)setCamera:(nonnull MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function;Swift func setCamera(_ camera: MGLMapCamera, withDuration duration: TimeInterval, animationTimingFunction function: CAMediaTimingFunction?)ParameterscameraThe new viewpoint. durationThe amount of time, measured in seconds, that the transition animation should take. Specify 0to jump to the new viewpoint instantaneously.functionA timing function used for the animation. Set this parameter to nilfor a transition that matches most system animations. If the duration is0, this parameter is ignored.
- 
                                -setCamera:withDuration:animationTimingFunction:completionHandler:Moves the viewpoint to a different location with respect to the map with an optional transition duration and timing function. For animated changes, wait until the map view has finished loading before calling this method. DeclarationObjective-C - (void)setCamera:(nonnull MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;Swift func setCamera(_ camera: MGLMapCamera, withDuration duration: TimeInterval, animationTimingFunction function: CAMediaTimingFunction?) asyncParameterscameraThe new viewpoint. durationThe amount of time, measured in seconds, that the transition animation should take. Specify 0to jump to the new viewpoint instantaneously.functionA timing function used for the animation. Set this parameter to nilfor a transition that matches most system animations. If the duration is0, this parameter is ignored.completionThe block to execute after the animation finishes. 
- 
                                -setCamera:withDuration:animationTimingFunction:edgePadding:completionHandler:Moves the viewpoint to a different location with respect to the map with an optional transition duration and timing function, and optionally some additional padding on each side. For animated changes, wait until the map view has finished loading before calling this method. DeclarationObjective-C - (void)setCamera:(nonnull MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function edgePadding:(UIEdgeInsets)edgePadding completionHandler:(nullable void (^)(void))completion;Swift func setCamera(_ camera: MGLMapCamera, withDuration duration: TimeInterval, animationTimingFunction function: CAMediaTimingFunction?, edgePadding: UIEdgeInsets) asyncParameterscameraThe new viewpoint. durationThe amount of time, measured in seconds, that the transition animation should take. Specify 0to jump to the new viewpoint instantaneously.functionA timing function used for the animation. Set this parameter to nilfor a transition that matches most system animations. If the duration is0, this parameter is ignored.edgePaddingThe minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. completionThe block to execute after the animation finishes. 
- 
                                -flyToCamera:completionHandler:Moves the viewpoint to a different location using a transition animation that evokes powered flight and a default duration based on the length of the flight path. The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. DeclarationObjective-C - (void)flyToCamera:(nonnull MGLMapCamera *)camera completionHandler:(nullable void (^)(void))completion;Swift func fly(to camera: MGLMapCamera) asyncParameterscameraThe new viewpoint. completionThe block to execute after the animation finishes. 
- 
                                -flyToCamera:withDuration:completionHandler:Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration. The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. DeclarationObjective-C - (void)flyToCamera:(nonnull MGLMapCamera *)camera withDuration:(NSTimeInterval)duration completionHandler:(nullable void (^)(void))completion;Swift func fly(to camera: MGLMapCamera, withDuration duration: TimeInterval) asyncParameterscameraThe new viewpoint. durationThe amount of time, measured in seconds, that the transition animation should take. Specify 0to jump to the new viewpoint instantaneously. Specify a negative value to use the default duration, which is based on the length of the flight path.completionThe block to execute after the animation finishes. 
- 
                                -flyToCamera:withDuration:peakAltitude:completionHandler:Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration and peak altitude. The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. DeclarationObjective-C - (void)flyToCamera:(nonnull MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion;Swift func fly(to camera: MGLMapCamera, withDuration duration: TimeInterval, peakAltitude: CLLocationDistance) asyncParameterscameraThe new viewpoint. durationThe amount of time, measured in seconds, that the transition animation should take. Specify 0to jump to the new viewpoint instantaneously. Specify a negative value to use the default duration, which is based on the length of the flight path.peakAltitudeThe altitude, measured in meters, at the midpoint of the animation. The value of this parameter is ignored if it is negative or if the animation transition resulting from a similar call to -setCamera:animated:would have a midpoint at a higher altitude.completionThe block to execute after the animation finishes. 
- 
                                -cameraThatFitsCoordinateBounds:Returns the camera that best fits the given coordinate bounds. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification; you may receive anilreturn value depending on the order of notification delivery.DeclarationObjective-C - (nonnull MGLMapCamera *)cameraThatFitsCoordinateBounds: (MGLCoordinateBounds)bounds;Swift func cameraThatFitsCoordinateBounds(_ bounds: MGLCoordinateBounds) -> MGLMapCameraParametersboundsThe coordinate bounds to fit to the receiver’s viewport. Return ValueA camera object centered on the same location as the coordinate bounds with zoom level as high (close to the ground) as possible while still including the entire coordinate bounds. The camera object uses the current direction and pitch. 
- 
                                -cameraThatFitsCoordinateBounds:edgePadding:Returns the camera that best fits the given coordinate bounds with some additional padding on each side. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification; you may receive anilreturn value depending on the order of notification delivery.DeclarationObjective-C - (nonnull MGLMapCamera *)cameraThatFitsCoordinateBounds: (MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets;Swift func cameraThatFitsCoordinateBounds(_ bounds: MGLCoordinateBounds, edgePadding insets: UIEdgeInsets) -> MGLMapCameraParametersboundsThe coordinate bounds to fit to the receiver’s viewport. insetsThe minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. Return ValueA camera object centered on the same location as the coordinate bounds with zoom level as high (close to the ground) as possible while still including the entire coordinate bounds. The camera object uses the current direction and pitch. 
- 
                                -camera:fittingCoordinateBounds:edgePadding:Returns the camera that best fits the given coordinate bounds with some additional padding on each side, matching an existing camera as much as possible. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification; you may receive anilreturn value depending on the order of notification delivery.DeclarationObjective-C - (nonnull MGLMapCamera *)camera:(nonnull MGLMapCamera *)camera fittingCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets;Swift func camera(_ camera: MGLMapCamera, fitting bounds: MGLCoordinateBounds, edgePadding insets: UIEdgeInsets) -> MGLMapCameraParameterscameraThe camera that the return camera should adhere to. All values on this camera will be manipulated except for pitch and direction. boundsThe coordinate bounds to fit to the receiver’s viewport. insetsThe minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. Return ValueA camera object centered on the same location as the coordinate bounds with zoom level as high (close to the ground) as possible while still including the entire coordinate bounds. The initial camera’s pitch and direction will be honored. 
- 
                                -camera:fittingShape:edgePadding:Returns the camera that best fits the given shape with some additional padding on each side, matching an existing camera as much as possible. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification; you may receive anilreturn value depending on the order of notification delivery.DeclarationObjective-C - (nonnull MGLMapCamera *)camera:(nonnull MGLMapCamera *)camera fittingShape:(nonnull MGLShape *)shape edgePadding:(UIEdgeInsets)insets;Swift func camera(_ camera: MGLMapCamera, fitting shape: MGLShape, edgePadding insets: UIEdgeInsets) -> MGLMapCameraParameterscameraThe camera that the return camera should adhere to. All values on this camera will be manipulated except for pitch and direction. shapeThe shape to fit to the receiver’s viewport. insetsThe minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. Return ValueA camera object centered on the shape’s center with zoom level as high (close to the ground) as possible while still including the entire shape. The initial camera’s pitch and direction will be honored. 
- 
                                -cameraThatFitsShape:direction:edgePadding:Returns the camera that best fits the given shape with some additional padding on each side while looking in the specified direction. Note The behavior of this method is undefined if called in response to UIApplicationWillTerminateNotification; you may receive anilreturn value depending on the order of notification delivery.DeclarationObjective-C - (nonnull MGLMapCamera *)cameraThatFitsShape:(nonnull MGLShape *)shape direction:(CLLocationDirection)direction edgePadding:(UIEdgeInsets)insets;Swift func cameraThatFitsShape(_ shape: MGLShape, direction: CLLocationDirection, edgePadding insets: UIEdgeInsets) -> MGLMapCameraParametersshapeThe shape to fit to the receiver’s viewport. directionThe direction of the viewport, measured in degrees clockwise from true north. insetsThe minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. Return ValueA camera object centered on the shape’s center with zoom level as high (close to the ground) as possible while still including the entire shape. The camera object uses the current pitch. 
- 
                                -anchorPointForGesture:Returns the point in this view’s coordinate system on which to “anchor” in response to a user-initiated gesture. For example, a pinch-to-zoom gesture would anchor the map at the midpoint of the pinch. If the userTrackingModeproperty is notMGLUserTrackingModeNone, the user annotation is used as the anchor point.Subclasses may override this method to provide specialized behavior - for example, anchoring on the map’s center point to provide a “locked” zooming mode. DeclarationObjective-C - (CGPoint)anchorPointForGesture:(nonnull UIGestureRecognizer *)gesture;Swift func anchorPoint(forGesture gesture: UIGestureRecognizer) -> CGPointParametersgestureAn anchorable user gesture. Return ValueThe point on which to anchor in response to the gesture. 
- 
                                contentInsetThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. When the value of this property is equal to UIEdgeInsetsZero, viewport properties such ascenterCoordinateassume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.When the map view’s superview is an instance of UIViewControllerwhoseautomaticallyAdjustsScrollViewInsetsproperty isYES, the value of this property may be overridden at any time.The usage of automaticallyAdjustsScrollViewInsetshas been deprecated use the map view’s propertyMGLMapView.automaticallyAdjustsContentInsetinstead.Changing the value of this property updates the map view immediately. If you want to animate the change, use the -setContentInset:animated:completionHandler:method instead.DeclarationObjective-C @property (nonatomic) UIEdgeInsets contentInset;Swift var contentInset: UIEdgeInsets { get set }
- 
                                cameraEdgeInsetsThe current edge insets of the current map view’s camera. Camera edge insets are formed as accumulation of map view’s content insets and the edge padding passed to the method like seCamera:...edgePadding:,setVisibleCoordinates:...edgePadding:,showAnnotations:...edgePadding:etc.The camera edge insets influences the centerCoordinateof the viewport. This value is read-only, in order to apply paddings, use either persistentcontentInset, either transientedgePaddingparameter of theset...methods.DeclarationObjective-C @property (nonatomic, readonly) UIEdgeInsets cameraEdgeInsets;Swift var cameraEdgeInsets: UIEdgeInsets { get }
- 
                                -setContentInset:animated:Deprecated Use -setContentInset:animated:completionHandler:instead.Deprecated. Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport with an optional transition animation. When the value of this property is equal to UIEdgeInsetsZero, viewport properties such ascenterCoordinateassume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.When the map view’s superview is an instance of UIViewControllerwhoseautomaticallyAdjustsScrollViewInsetsproperty isYES, the value of this property may be overridden at any time.The usage of automaticallyAdjustsScrollViewInsetshas been deprecated use the map view’s propertyMGLMapView.automaticallyAdjustsContentInsetinstead.To specify a completion handler to execute after the animation finishes, use the -setContentInset:animated:completionHandler:method.DeclarationObjective-C - (void)setContentInset:(UIEdgeInsets)contentInset animated:(BOOL)animated;Swift func setContentInset(_ contentInset: UIEdgeInsets, animated: Bool)ParameterscontentInsetThe new values to inset the content by. animatedSpecify YESif you want the map view to animate the change to the content inset orNOif you want the map to inset the content immediately.
- 
                                -setContentInset:animated:completionHandler:Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport with an optional transition animation and completion handler. When the value of this property is equal to UIEdgeInsetsZero, viewport properties such ascenterCoordinateassume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.When the map view’s superview is an instance of UIViewControllerwhoseautomaticallyAdjustsScrollViewInsetsproperty isYES, the value of this property may be overridden at any time.The usage of automaticallyAdjustsScrollViewInsetshas been deprecated use the map view’s propertyMGLMapView.automaticallyAdjustsContentInsetinstead.DeclarationObjective-C - (void)setContentInset:(UIEdgeInsets)contentInset animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;Swift func setContentInset(_ contentInset: UIEdgeInsets, animated: Bool) asyncParameterscontentInsetThe new values to inset the content by. animatedSpecify YESif you want the map view to animate the change to the content inset orNOif you want the map to inset the content immediately.completionThe block executed after the animation finishes. 
Converting Geographic Coordinates
- 
                                -convertPoint:toCoordinateFromView:Converts a point in the given view’s coordinate system to a geographic coordinate. Related examplesSee the Point conversion example to learn how to convert a CGPointto a map coordinate.DeclarationObjective-C - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(nullable UIView *)view;Swift func convert(_ point: CGPoint, toCoordinateFrom view: UIView?) -> CLLocationCoordinate2DParameterspointThe point to convert. viewThe view in whose coordinate system the point is expressed. Return ValueThe geographic coordinate at the given point. 
- 
                                -convertCoordinate:toPointToView:Converts a geographic coordinate to a point in the given view’s coordinate system. Related examplesSee the Point conversion example to learn how to convert a map coordinate to a CGPointobject.DeclarationObjective-C - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(nullable UIView *)view;Swift func convert(_ coordinate: CLLocationCoordinate2D, toPointTo view: UIView?) -> CGPointParameterscoordinateThe geographic coordinate to convert. viewThe view in whose coordinate system the returned point should be expressed. If this parameter is nil, the returned point is expressed in the window’s coordinate system. Ifviewis notnil, it must belong to the same window as the map view.Return ValueThe point (in the appropriate view or window coordinate system) corresponding to the given geographic coordinate. 
- 
                                -convertRect:toCoordinateBoundsFromView:Converts a rectangle in the given view’s coordinate system to a geographic bounding box. If the returned coordinate bounds contains a longitude is less than −180 degrees or greater than 180 degrees, the bounding box straddles the antimeridian or international date line. DeclarationObjective-C - (MGLCoordinateBounds)convertRect:(CGRect)rect toCoordinateBoundsFromView:(nullable UIView *)view;Swift func convert(_ rect: CGRect, toCoordinateBoundsFrom view: UIView?) -> MGLCoordinateBoundsParametersrectThe rectangle to convert. viewThe view in whose coordinate system the rectangle is expressed. Return ValueThe geographic bounding box coextensive with the given rectangle. 
- 
                                -convertCoordinateBounds:toRectToView:Converts a geographic bounding box to a rectangle in the given view’s coordinate system. To bring both sides of the antimeridian or international date line into view, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, to show both Tokyo and San Francisco simultaneously, you could set the visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). DeclarationObjective-C - (CGRect)convertCoordinateBounds:(MGLCoordinateBounds)bounds toRectToView:(nullable UIView *)view;Swift func convert(_ bounds: MGLCoordinateBounds, toRectTo view: UIView?) -> CGRectParametersboundsThe geographic bounding box to convert. viewThe view in whose coordinate system the returned rectangle should be expressed. If this parameter is nil, the returned rectangle is expressed in the window’s coordinate system. Ifviewis notnil, it must belong to the same window as the map view.
- 
                                -metersPerPointAtLatitude:Returns the distance spanned by one point in the map view’s coordinate system at the given latitude and current zoom level. The distance between points decreases as the latitude approaches the poles. This relationship parallels the relationship between longitudinal coordinates at different latitudes. DeclarationObjective-C - (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude;Swift func metersPerPoint(atLatitude latitude: CLLocationDegrees) -> CLLocationDistanceParameterslatitudeThe latitude of the geographic coordinate represented by the point. Return ValueThe distance in meters spanned by a single point. 
- 
                                -mapProjectionReturns the new map projection instance initialized with the map view, i.e. with the current camera state. DeclarationObjective-C - (nonnull MGLMapProjection *)mapProjection;Swift func mapProjection() -> MGLMapProjection
Annotating the Map
- 
                                annotationsThe complete list of annotations associated with the receiver. (read-only) The objects in this array must adopt the MGLAnnotationprotocol. If no annotations are associated with the map view, the value of this property isnil.DeclarationObjective-C @property (nonatomic, readonly, nullable) NSArray<id<MGLAnnotation>> *annotations;
- 
                                -addAnnotation:Adds an annotation to the map view. Note MGLMultiPolyline,MGLMultiPolygon,MGLShapeCollection, andMGLPointCollectionobjects cannot be added to the map view at this time. Any multipoint, multipolyline, multipolygon, shape or point collection object that is specified is silently ignored.Related examplesSee the Annotation models and Add a line annotation from GeoJSON examples to learn how to add an annotation to an MGLMapViewobject.DeclarationObjective-C - (void)addAnnotation:(nonnull id<MGLAnnotation>)annotation;ParametersannotationThe annotation object to add to the receiver. This object must conform to the MGLAnnotationprotocol. The map view retains the annotation object.
- 
                                -addAnnotations:Adds an array of annotations to the map view. Note MGLMultiPolyline,MGLMultiPolygon, andMGLShapeCollectionobjects cannot be added to the map view at this time. Nor canMGLMultiPointobjects that are not instances ofMGLPolylineorMGLPolygon. Any multipoint, multipolyline, multipolygon, or shape collection objects that are specified are silently ignored.DeclarationObjective-C - (void)addAnnotations:(nonnull NSArray<id<MGLAnnotation>> *)annotations;ParametersannotationsAn array of annotation objects. Each object in the array must conform to the MGLAnnotationprotocol. The map view retains each individual annotation object.
- 
                                -removeAnnotation:Removes an annotation from the map view, deselecting it if it is selected. Removing an annotation object dissociates it from the map view entirely, preventing it from being displayed on the map. Thus you would typically call this method only when you want to hide or delete a given annotation. DeclarationObjective-C - (void)removeAnnotation:(nonnull id<MGLAnnotation>)annotation;ParametersannotationThe annotation object to remove. This object must conform to the MGLAnnotationprotocol
- 
                                -removeAnnotations:Removes an array of annotations from the map view, deselecting any selected annotations in the array. Removing annotation objects dissociates them from the map view entirely, preventing them from being displayed on the map. Thus you would typically call this method only when you want to hide or delete the given annotations. DeclarationObjective-C - (void)removeAnnotations:(nonnull NSArray<id<MGLAnnotation>> *)annotations;ParametersannotationsThe array of annotation objects to remove. Objects in the array must conform to the MGLAnnotationprotocol.
- 
                                -viewForAnnotation:Returns an MGLAnnotationViewif the given annotation is currently associated with a view, otherwise nil.DeclarationObjective-C - (nullable MGLAnnotationView *)viewForAnnotation: (nonnull id<MGLAnnotation>)annotation;ParametersannotationThe annotation associated with the view. Annotation must conform to the MGLAnnotationprotocol.
- 
                                -dequeueReusableAnnotationImageWithIdentifier:Returns a reusable annotation image object associated with its identifier. For performance reasons, you should generally reuse MGLAnnotationImageobjects for identical-looking annotations in your map views. Dequeueing saves time and memory during performance-critical operations such as scrolling.Related examplesSee the Add annotation views and images example learn how to most efficiently reuse an MGLAnnotationImage.DeclarationObjective-C - (nullable __kindof MGLAnnotationImage *) dequeueReusableAnnotationImageWithIdentifier:(nonnull NSString *)identifier;Swift func dequeueReusableAnnotationImage(withIdentifier identifier: String) -> MGLAnnotationImage?ParametersidentifierA string identifying the annotation image to be reused. This string is the same one you specify when initially returning the annotation image object using the -mapView:imageForAnnotation:method.Return ValueAn annotation image object with the given identifier, or nilif no such object exists in the reuse queue.
- 
                                -dequeueReusableAnnotationViewWithIdentifier:Returns a reusable annotation view object associated with its identifier. For performance reasons, you should generally reuse MGLAnnotationViewobjects for identical-looking annotations in your map views. Dequeueing saves time and memory during performance-critical operations such as scrolling.DeclarationObjective-C - (nullable __kindof MGLAnnotationView *) dequeueReusableAnnotationViewWithIdentifier:(nonnull NSString *)identifier;Swift func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MGLAnnotationView?ParametersidentifierA string identifying the annotation view to be reused. This string is the same one you specify when initially returning the annotation view object using the -mapView:viewForAnnotation:method.Return ValueAn annotation view object with the given identifier, or nilif no such object exists in the reuse queue.
- 
                                visibleAnnotationsThe complete list of annotations associated with the receiver that are currently visible. The objects in this array must adopt the MGLAnnotationprotocol. If no annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property isnil.DeclarationObjective-C @property (nonatomic, readonly, nullable) NSArray<id<MGLAnnotation>> *visibleAnnotations;
- 
                                -visibleAnnotationsInRect:Returns the list of annotations associated with the receiver that intersect with the given rectangle. DeclarationObjective-C - (nullable NSArray<id<MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect;ParametersrectA rectangle expressed in the map view’s coordinate system. Return ValueAn array of objects that adopt the MGLAnnotationprotocol ornilif no annotations associated with the map view are currently visible in the rectangle.
Managing Annotation Selections
- 
                                selectedAnnotationsThe currently selected annotations. Assigning a new array to this property selects only the first annotation in the array. If the annotation is of type MGLPointAnnotationand is offscreen, the camera will animate to bring the annotation and its callout just on screen. If you need finer control, consider using-selectAnnotation:animated:.Note In versions prior to4.0.0if the annotation was offscreen it was not selected.DeclarationObjective-C @property (nonatomic, copy) NSArray<id<MGLAnnotation>> *_Nonnull selectedAnnotations;
- 
                                -selectAnnotation:animated:Deprecated Use -selectAnnotation:animated:completionHandler:instead.Deprecated. Selects an annotation and displays its callout view. The animatedparameter determines whether the selection is animated including whether the map is panned to bring the annotation into view, specifically:animatedparameterEffect NOThe annotation is selected, and the callout is presented. However the map is not panned to bring the annotation or callout into view. The presentation of the callout is NOT animated. YESThe annotation is selected, and the callout is presented. If the annotation is not visible (or is partially visible) and is of type MGLPointAnnotation, the map is panned so that the annotation and its callout are brought into view. The annotation is not centered within the viewport.Note that a selection initiated by a single tap gesture is always animated. To specify a completion handler to execute after the animation finishes, use the -selectAnnotation:animated:completionHandler:method.Note In versions prior to 4.0.0selecting an offscreen annotation did not change the camera.DeclarationObjective-C - (void)selectAnnotation:(nonnull id<MGLAnnotation>)annotation animated:(BOOL)animated;ParametersannotationThe annotation object to select. animatedIf YES, the annotation and callout view are animated on-screen.
- 
                                -selectAnnotation:animated:completionHandler:Selects an annotation and displays its callout view with an optional completion handler. The animatedparameter determines whether the selection is animated including whether the map is panned to bring the annotation into view, specifically:animatedparameterEffect NOThe annotation is selected, and the callout is presented. However the map is not panned to bring the annotation or callout into view. The presentation of the callout is NOT animated. YESThe annotation is selected, and the callout is presented. If the annotation is not visible (or is partially visible) and is of type MGLPointAnnotation, the map is panned so that the annotation and its callout are brought into view. The annotation is not centered within the viewport.Note that a selection initiated by a single tap gesture is always animated. Note In versions prior to 4.0.0selecting an offscreen annotation did not change the camera.DeclarationObjective-C - (void)selectAnnotation:(nonnull id<MGLAnnotation>)annotation animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;ParametersannotationThe annotation object to select. animatedIf YES, the annotation and callout view are animated on-screen.completionThe block executed after the animation finishes. 
- 
                                -deselectAnnotation:animated:Deselects an annotation and hides its callout view. DeclarationObjective-C - (void)deselectAnnotation:(nullable id<MGLAnnotation>)annotation animated:(BOOL)animated;ParametersannotationThe annotation object to deselect. animatedIf YES, the callout view is animated offscreen.
Overlaying the Map
- 
                                overlaysThe complete list of overlays associated with the receiver. (read-only) The objects in this array must adopt the MGLOverlayprotocol. If no overlays are associated with the map view, the value of this property is empty array.DeclarationObjective-C @property (nonatomic, readonly, nonnull) NSArray<id<MGLOverlay>> *overlays;
- 
                                -addOverlay:Adds a single overlay object to the map. To remove an overlay from a map, use the -removeOverlay:method.DeclarationObjective-C - (void)addOverlay:(nonnull id<MGLOverlay>)overlay;ParametersoverlayThe overlay object to add. This object must conform to the MGLOverlayprotocol.
- 
                                -addOverlays:Adds an array of overlay objects to the map. To remove multiple overlays from a map, use the -removeOverlays:method.DeclarationObjective-C - (void)addOverlays:(nonnull NSArray<id<MGLOverlay>> *)overlays;ParametersoverlaysAn array of objects, each of which must conform to the MGLOverlayprotocol.
- 
                                -removeOverlay:Removes a single overlay object from the map. If the specified overlay is not currently associated with the map view, this method does nothing. DeclarationObjective-C - (void)removeOverlay:(nonnull id<MGLOverlay>)overlay;ParametersoverlayThe overlay object to remove. 
- 
                                -removeOverlays:Removes one or more overlay objects from the map. If a given overlay object is not associated with the map view, it is ignored. DeclarationObjective-C - (void)removeOverlays:(nonnull NSArray<id<MGLOverlay>> *)overlays;ParametersoverlaysAn array of objects, each of which conforms to the MGLOverlayprotocol.
Accessing the Underlying Map Data
- 
                                -visibleFeaturesAtPoint:Returns an array of rendered map features that intersect with a given point. This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:method. For more information about searching for map features, see that method’s documentation.Related examplesSee the Select a feature within a layer example to learn how to query an MGLMapViewobject for visibleMGLFeatureobjects.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point;ParameterspointA point expressed in the map view’s coordinate system. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
- 
                                -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:Returns an array of rendered map features that intersect with a given point, restricted to the given style layers. This method returns all the intersecting features from the specified layers. To filter the returned features, use the -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:method. For more information about searching for map features, see that method’s documentation.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers: (nullable NSSet<NSString *> *) styleLayerIdentifiers;ParameterspointA point expressed in the map view’s coordinate system. styleLayerIdentifiersA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
- 
                                -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:Returns an array of rendered map features that intersect with a given point, restricted to the given style layers and filtered by the given predicate. Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant map content sources. The returned array includes features loaded by MGLShapeSourceandMGLVectorTileSourceobjects but does not include anything fromMGLRasterTileSourceobjects, or from video or canvas sources, which are unsupported by this SDK.The returned features are drawn by a style layer in the current style. For example, suppose the current style uses the Mapbox Streets source, but none of the specified style layers includes features that have the makiproperty set tobus. If you pass a point corresponding to the location of a bus stop into this method, the bus stop feature does not appear in the resulting array. On the other hand, if the style does include bus stops, anMGLFeatureobject representing that bus stop is returned and itsfeatureAttributesdictionary has themakikey set tobus(along with other attributes). The dictionary contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style.The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified point lies along a road that spans the screen. The resulting array includes those parts of the road that lie within the map tile that contain the specified point, even if the road extends into other tiles. To find out the layer names in a particular style, view the style in Mapbox Studio. Only visible features are returned. To obtain features regardless of visibility, use the -[MGLVectorTileSource featuresInSourceLayersWithIdentifiers:predicate:]and-[MGLShapeSource featuresMatchingPredicate:]methods on the relevant sources.The returned features may also include features corresponding to annotations. These features are not object-equal to the MGLAnnotationobjects that were originally added to the map. To query the map for annotations, usevisibleAnnotationsor-[MGLMapView visibleAnnotationsInRect:].Note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like +[MGLStyle outdoorsStyleURLWithVersion:],MGLMapView’s “Style URL” inspectable in Interface Builder, or a manually constructedNSURL. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *) visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers: (nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate;ParameterspointA point expressed in the map view’s coordinate system. styleLayerIdentifiersA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array. predicateA predicate to filter the returned features. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
- 
                                -visibleFeaturesInRect:Returns an array of rendered map features that intersect with the given rectangle. This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:method. For more information about searching for map features, see that method’s documentation.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect;ParametersrectA rectangle expressed in the map view’s coordinate system. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
- 
                                -visibleFeaturesInRect:inStyleLayersWithIdentifiers:Returns an array of rendered map features that intersect with the given rectangle, restricted to the given style layers. This method returns all the intersecting features from the specified layers. To filter the returned features, use the -visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:method. For more information about searching for map features, see that method’s documentation.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers: (nullable NSSet<NSString *> *) styleLayerIdentifiers;ParametersrectA rectangle expressed in the map view’s coordinate system. styleLayerIdentifiersA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
- 
                                -visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:Returns an array of rendered map features that intersect with the given rectangle, restricted to the given style layers and filtered by the given predicate. Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant map content sources. The returned array includes features loaded by MGLShapeSourceandMGLVectorTileSourceobjects but does not include anything fromMGLRasterTileSourceobjects, or from video or canvas sources, which are unsupported by this SDK.The returned features are drawn by a style layer in the current style. For example, suppose the current style uses the Mapbox Streets source, but none of the specified style layers includes features that have the makiproperty set tobus. If you pass a rectangle containing the location of a bus stop into this method, the bus stop feature does not appear in the resulting array. On the other hand, if the style does include bus stops, anMGLFeatureobject representing that bus stop is returned and itsfeatureAttributesdictionary has themakikey set tobus(along with other attributes). The dictionary contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style.The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified rectangle intersects with a road that spans the screen. The resulting array includes those parts of the road that lie within the map tiles covering the specified rectangle, even if the road extends into other tiles. The portion of the road within each map tile is included individually. To find out the layer names in a particular style, view the style in Mapbox Studio. Only visible features are returned. To obtain features regardless of visibility, use the -[MGLVectorTileSource featuresInSourceLayersWithIdentifiers:predicate:]and-[MGLShapeSource featuresMatchingPredicate:]methods on the relevant sources.Note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like +[MGLStyle outdoorsStyleURLWithVersion:],MGLMapView’s “Style URL” inspectable in Interface Builder, or a manually constructedNSURL. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time.Note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like +[MGLStyle outdoorsStyleURLWithVersion:],MGLMapView’s “Style URL” inspectable in Interface Builder, or a manually constructedNSURL. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time.DeclarationObjective-C - (nonnull NSArray<id<MGLFeature>> *) visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers: (nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate;ParametersrectA rectangle expressed in the map view’s coordinate system. styleLayerIdentifiersA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array. predicateA predicate to filter the returned features. Return ValueAn array of objects conforming to the MGLFeatureprotocol that represent features in the sources used by the current style.
Debugging the Map
- 
                                debugMaskThe options that determine which debugging aids are shown on the map. These options are all disabled by default and should remain disabled in released software for performance and aesthetic reasons. DeclarationObjective-C @property (nonatomic) MGLMapDebugMaskOptions debugMask;Swift var debugMask: MGLMapDebugMaskOptions { get set }
MGLMapViewDelegate
@protocol MGLMapViewDelegate <NSObject>The MGLMapViewDelegate protocol defines a set of optional methods that you
                            can use to receive map-related update messages. Because many map operations
                            require the MGLMapView class to load
                            data asynchronously, the map view calls
                            these methods to notify your application when specific operations complete. The
                            map view also uses these methods to request information about annotations
                            displayed on the map, such as the styles and interaction modes to apply to
                            individual annotations.
Responding to Map Position Changes
- 
                                -mapView:shouldChangeFromCamera:toCamera:Asks the delegate whether the map view should be allowed to change from the existing camera to the new camera in response to a user gesture. This method is called as soon as the user gesture is recognized. It is not called in response to a programmatic camera change, such as by setting the centerCoordinateproperty or calling-flyToCamera:completionHandler:.This method is called many times during gesturing, so you should avoid performing complex or performance-intensive tasks in your implementation. Related examplesSee the Restrict map panning to an area example to learn how to use this method and MGLMapCameraobjects to restrict a users ability to pan your map.DeclarationObjective-C - (BOOL)mapView:(nonnull MGLMapView *)mapView shouldChangeFromCamera:(nonnull MGLMapCamera *)oldCamera toCamera:(nonnull MGLMapCamera *)newCamera;Swift optional func mapView(_ mapView: MGLMapView, shouldChangeFrom oldCamera: MGLMapCamera, to newCamera: MGLMapCamera) -> BoolParametersmapViewThe map view that the user is manipulating. oldCameraThe camera representing the viewpoint at the moment the gesture is recognized. If this method returns NO, the map view’s camera continues to be this camera.newCameraThe expected camera after the gesture completes. If this method returns YES, this camera becomes the map view’s camera.Return ValueA Boolean value indicating whether the map view should stay at oldCameraor change tonewCamera.
- 
                                -mapView:regionWillChangeAnimated:Tells the delegate that the viewpoint depicted by the map view is about to change. This method is called whenever the currently displayed map camera will start changing for any reason. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView regionWillChangeAnimated:(BOOL)animated;Swift optional func mapView(_ mapView: MGLMapView, regionWillChangeAnimated animated: Bool)ParametersmapViewThe map view whose viewpoint will change. animatedWhether the change will cause an animated effect on the map. 
- 
                                -mapViewRegionIsChanging:Tells the delegate that the viewpoint depicted by the map view is changing. This method is called as the currently displayed map camera changes as part of an animation, whether due to a user gesture or due to a call to a method such as -[MGLMapView setCamera:animated:]. This method can be called before-mapViewDidFinishLoadingMap:is called.During the animation, this method may be called many times to report updates to the viewpoint. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. Related examplesSee the Cluster point data example to learn how to trigger an action whenever the map region changes. DeclarationObjective-C - (void)mapViewRegionIsChanging:(nonnull MGLMapView *)mapView;Swift optional func mapViewRegionIsChanging(_ mapView: MGLMapView)ParametersmapViewThe map view whose viewpoint is changing. 
- 
                                -mapView:regionDidChangeAnimated:Tells the delegate that the viewpoint depicted by the map view has finished changing. This method is called whenever the currently displayed map camera has finished changing, after any calls to -mapViewRegionIsChanging:due to animation. Therefore, this method can be called before-mapViewDidFinishLoadingMap:is called.DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated;Swift optional func mapView(_ mapView: MGLMapView, regionDidChangeAnimated animated: Bool)ParametersmapViewThe map view whose viewpoint has changed. animatedWhether the change caused an animated effect on the map. 
Loading the Map
- 
                                -mapViewWillStartLoadingMap:Tells the delegate that the map view will begin to load. This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. DeclarationObjective-C - (void)mapViewWillStartLoadingMap:(nonnull MGLMapView *)mapView;Swift optional func mapViewWillStartLoadingMap(_ mapView: MGLMapView)ParametersmapViewThe map view that is starting to load. 
- 
                                -mapViewDidFinishLoadingMap:Tells the delegate that the map view has finished loading. This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. DeclarationObjective-C - (void)mapViewDidFinishLoadingMap:(nonnull MGLMapView *)mapView;Swift optional func mapViewDidFinishLoadingMap(_ mapView: MGLMapView)ParametersmapViewThe map view that has finished loading. 
- 
                                -mapViewDidFailLoadingMap:withError:Tells the delegate that the map view was unable to load data needed for displaying the map. This method may be called for a variety of reasons, including a network connection failure or a failure to fetch the style from the server. You can use the given error message to notify the user that map data is unavailable. DeclarationObjective-C - (void)mapViewDidFailLoadingMap:(nonnull MGLMapView *)mapView withError:(nonnull NSError *)error;Swift optional func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error)ParametersmapViewThe map view that is unable to load the data. errorThe reason the data could not be loaded. 
- 
                                -mapViewWillStartRenderingFrame:Tells the delegate that the map view is about to redraw. This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than -mapViewRegionIsChanging:. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance.DeclarationObjective-C - (void)mapViewWillStartRenderingFrame:(nonnull MGLMapView *)mapView;Swift optional func mapViewWillStartRenderingFrame(_ mapView: MGLMapView)ParametersmapViewThe map view that is about to redraw. 
- 
                                -mapViewDidFinishRenderingFrame:fullyRendered:Tells the delegate that the map view has just redrawn. This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than -mapViewRegionIsChanging:. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance.DeclarationObjective-C - (void)mapViewDidFinishRenderingFrame:(nonnull MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered;Swift optional func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool)ParametersmapViewThe map view that has just redrawn. 
- 
                                -mapViewDidBecomeIdle:Tells the delegate that the map view is entering an idle state, and no more drawing will be necessary until new data is loaded or there is some interaction with the map. - No camera transitions are in progress
- All currently requested tiles have loaded
- 
                                          All fade/transition animations have completed 
 DeclarationObjective-C - (void)mapViewDidBecomeIdle:(nonnull MGLMapView *)mapView;Swift optional func mapViewDidBecomeIdle(_ mapView: MGLMapView)ParametersmapViewThe map view that has just entered the idle state. 
- 
                                -mapView:didFinishLoadingStyle:Tells the delegate that the map has just finished loading a style. This method is called during the initialization of the map view and after any subsequent loading of a new style. This method is called between the -mapViewWillStartRenderingMap:and-mapViewDidFinishRenderingMap:delegate methods. Changes to sources or layers of the current style do not cause this method to be called.This method is the earliest opportunity to modify the layout or appearance of the current style before the map view is displayed to the user. Related examplesSee the Dynamically style interactive points and Add multiple shapes from a single shape source examples to learn how to ensure a map’s style has loaded before modifying it at runtime. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didFinishLoadingStyle:(nonnull MGLStyle *)style;Swift optional func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle)ParametersmapViewThe map view that has just loaded a style. styleThe style that was loaded. 
- 
                                -mapView:shouldRemoveStyleImage:Asks the delegate whether the map view should evict cached images. This method is called in two scenarios: when the cumulative size of unused images exceeds the cache size or when the last tile that includes the image is removed from memory. DeclarationObjective-C - (BOOL)mapView:(nonnull MGLMapView *)mapView shouldRemoveStyleImage:(nonnull NSString *)imageName;Swift optional func mapView(_ mapView: MGLMapView, shouldRemoveStyleImage imageName: String) -> BoolParametersmapViewThe map view that is evicting the image. imageNameThe image name that is going to be removed. Return ValueA Boolean value indicating whether the map view should evict the cached image. 
Tracking User Location
- 
                                -mapViewWillStartLocatingUser:Tells the delegate that the map view will begin tracking the user’s location. This method is called when the value of the showsUserLocationproperty changes toYES.DeclarationObjective-C - (void)mapViewWillStartLocatingUser:(nonnull MGLMapView *)mapView;Swift optional func mapViewWillStartLocatingUser(_ mapView: MGLMapView)ParametersmapViewThe map view that is tracking the user’s location. 
- 
                                -mapViewDidStopLocatingUser:Tells the delegate that the map view has stopped tracking the user’s location. This method is called when the value of the showsUserLocationproperty changes toNO.DeclarationObjective-C - (void)mapViewDidStopLocatingUser:(nonnull MGLMapView *)mapView;Swift optional func mapViewDidStopLocatingUser(_ mapView: MGLMapView)ParametersmapViewThe map view that is tracking the user’s location. 
- 
                                -mapViewStyleForDefaultUserLocationAnnotationView:Asks the delegate styling options for each default user location annotation view. This method is called many times during gesturing, so you should avoid performing complex or performance-intensive tasks in your implementation. DeclarationObjective-C - (nonnull MGLUserLocationAnnotationViewStyle *) mapViewStyleForDefaultUserLocationAnnotationView: (nonnull MGLMapView *)mapView;Swift optional func mapView(styleForDefaultUserLocationAnnotationView mapView: MGLMapView) -> MGLUserLocationAnnotationViewStyleParametersmapViewThe map view that is tracking the user’s location. 
- 
                                -mapView:didUpdateUserLocation:Tells the delegate that the location of the user was updated. While the showsUserLocationproperty is set toYES, this method is called whenever a new location update is received by the map view. This method is also called if the map view’s user tracking mode is set toMGLUserTrackingModeFollowWithHeadingand the heading changes, or if it is set toMGLUserTrackingModeFollowWithCourseand the course changes.This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didUpdateUserLocation:(nullable MGLUserLocation *)userLocation;Swift optional func mapView(_ mapView: MGLMapView, didUpdate userLocation: MGLUserLocation?)ParametersmapViewThe map view that is tracking the user’s location. userLocationThe location object representing the user’s latest location. This property may be nil.
- 
                                -mapView:didFailToLocateUserWithError:Tells the delegate that an attempt to locate the user’s position failed. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didFailToLocateUserWithError:(nonnull NSError *)error;Swift optional func mapView(_ mapView: MGLMapView, didFailToLocateUserWithError error: Error)ParametersmapViewThe map view that is tracking the user’s location. errorAn error object containing the reason why location tracking failed. 
- 
                                -mapView:didChangeUserTrackingMode:animated:Tells the delegate that the map view’s user tracking mode has changed. This method is called after the map view asynchronously changes to reflect the new user tracking mode, for example by beginning to zoom or rotate. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated;Swift optional func mapView(_ mapView: MGLMapView, didChange mode: MGLUserTrackingMode, animated: Bool)ParametersmapViewThe map view that changed its tracking mode. modeThe new tracking mode. animatedWhether the change caused an animated effect on the map. 
- 
                                -mapViewUserLocationAnchorPoint:Returns a screen coordinate at which to position the user location annotation. This coordinate is relative to the map view’s origin after applying the map view’s content insets. When unimplemented, the user location annotation is aligned within the center of the map view with respect to the content insets. This method will override any values set by MGLMapView.userLocationVerticalAlignmentor-[MGLMapView setUserLocationVerticalAlignment:animated:].DeclarationObjective-C - (CGPoint)mapViewUserLocationAnchorPoint:(nonnull MGLMapView *)mapView;Swift optional func mapViewUserLocationAnchorPoint(_ mapView: MGLMapView) -> CGPointParametersmapViewThe map view that is tracking the user’s location. 
- 
                                -mapView:didChangeLocationManagerAuthorization:Tells the delegate that the map’s location updates accuracy authorization has changed. This method is called after the user changes location accuracy authorization when requesting location permissions or in privacy settings. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didChangeLocationManagerAuthorization: (nonnull id<MGLLocationManager>)manager;Swift optional func mapView(_ mapView: MGLMapView, didChangeLocationManagerAuthorization manager: MGLLocationManager)ParametersmapViewThe map view that changed its location accuracy authorization. managerThe location manager reporting the update. 
Managing the Appearance of Annotations
- 
                                -mapView:imageForAnnotation:Returns an annotation image object to mark the given point annotation object on the map. Implement this method to mark a point annotation with a static image. If you want to mark a particular point annotation with an annotation view instead, omit this method or have it return nilfor that annotation, then implement-mapView:viewForAnnotation:.Static annotation images use less memory and draw more quickly than annotation views. On the other hand, annotation views are compatible with UIKit, Core Animation, and other Cocoa Touch frameworks. Related examplesSee the Annotation models, Add annotation views and images, and Mark a place on the map with an image examples to learn to specify which image should be used for MGLAnnotationobjects that have been added to your map.DeclarationObjective-C - (nullable MGLAnnotationImage *)mapView:(nonnull MGLMapView *)mapView imageForAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage?ParametersmapViewThe map view that requested the annotation image. annotationThe object representing the annotation that is about to be displayed. Return ValueThe annotation image object to display for the given annotation or nilif you want to display the default marker image or an annotation view.
- 
                                -mapView:alphaForShapeAnnotation:Returns the alpha value to use when rendering a shape annotation. A value of 0.0results in a completely transparent shape. A value of1.0, the default, results in a completely opaque shape.This method sets the opacity of an entire shape, inclusive of its stroke and fill. To independently set the values for stroke or fill, specify an alpha component in the color returned by -mapView:strokeColorForShapeAnnotation:or-mapView:fillColorForPolygonAnnotation:.DeclarationObjective-C - (CGFloat)mapView:(nonnull MGLMapView *)mapView alphaForShapeAnnotation:(nonnull MGLShape *)annotation;Swift optional func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloatParametersmapViewThe map view rendering the shape annotation. annotationThe annotation being rendered. Return ValueAn alpha value between 0and1.0.
- 
                                -mapView:strokeColorForShapeAnnotation:Returns the color to use when rendering the outline of a shape annotation. The default stroke color is the map view’s tint color. If a pattern color is specified, the result is undefined. Opacity may be set by specifying an alpha component. The default alpha value is 1.0and results in a completely opaque stroke.Related examplesSee the Annotation models example to learn how to modify the outline color of an MGLShapeobject that has been added to your map as an annotation.DeclarationObjective-C - (nonnull UIColor *)mapView:(nonnull MGLMapView *)mapView strokeColorForShapeAnnotation:(nonnull MGLShape *)annotation;Swift optional func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColorParametersmapViewThe map view rendering the shape annotation. annotationThe annotation being rendered. Return ValueA color to use for the shape outline. 
- 
                                -mapView:fillColorForPolygonAnnotation:Returns the color to use when rendering the fill of a polygon annotation. The default fill color is the map view’s tint color. If a pattern color is specified, the result is undefined. Opacity may be set by specifying an alpha component. The default alpha value is 1.0and results in a completely opaque shape.Related examplesSee the Add a polygon annotation example to learn how to modify the color of a an MGLPolygonat runtime.DeclarationObjective-C - (nonnull UIColor *)mapView:(nonnull MGLMapView *)mapView fillColorForPolygonAnnotation:(nonnull MGLPolygon *)annotation;Swift optional func mapView(_ mapView: MGLMapView, fillColorForPolygonAnnotation annotation: MGLPolygon) -> UIColorParametersmapViewThe map view rendering the polygon annotation. annotationThe annotation being rendered. Return ValueThe polygon’s interior fill color. 
- 
                                -mapView:lineWidthForPolylineAnnotation:Returns the line width in points to use when rendering the outline of a polyline annotation. By default, the polyline is outlined with a line 3.0points wide.Related examplesSee the Add a line annotation from GeoJSON example to learn how to modify the line width of an MGLPolylineFeatureon your map.DeclarationObjective-C - (CGFloat)mapView:(nonnull MGLMapView *)mapView lineWidthForPolylineAnnotation:(nonnull MGLPolyline *)annotation;Swift optional func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloatParametersmapViewThe map view rendering the polygon annotation. annotationThe annotation being rendered. Return ValueA line width for the polyline, measured in points. 
- 
                                -mapView:viewForAnnotation:Returns a view object to mark the given point annotation object on the map. Implement this method to mark a point annotation with a view object. If you want to mark a particular point annotation with a static image instead, omit this method or have it return nilfor that annotation, then implement-mapView:imageForAnnotation:instead.Annotation views are compatible with UIKit, Core Animation, and other Cocoa Touch frameworks. On the other hand, static annotation images use less memory and draw more quickly than annotation views. The user location annotation view can also be customized via this method. When annotationis an instance ofMGLUserLocation(or equal to the map view’suserLocationproperty), return an instance ofMGLUserLocationAnnotationView(or a subclass thereof).Related examplesSee the Add annotation views and images example to learn how to specify what MGLViewAnnotationto use for a givenMGLPointAnnotationobject on your map.DeclarationObjective-C - (nullable MGLAnnotationView *)mapView:(nonnull MGLMapView *)mapView viewForAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView?ParametersmapViewThe map view that requested the annotation view. annotationThe object representing the annotation that is about to be displayed. Return ValueThe view object to display for the given annotation or nilif you want to display an annotation image instead.
- 
                                -mapView:didAddAnnotationViews:Tells the delegate that one or more annotation views have been added and positioned on the map. This method is called just after the views are added to the map. You can implement this method to animate the addition of the annotation views. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didAddAnnotationViews: (nonnull NSArray<MGLAnnotationView *> *)annotationViews;Swift optional func mapView(_ mapView: MGLMapView, didAdd annotationViews: [MGLAnnotationView])ParametersmapViewThe map view to which the annotation views were added. annotationViewsAn array of MGLAnnotationViewobjects representing the views that were added.
- 
                                -mapView:shapeAnnotationIsEnabled:Returns a Boolean value indicating whether the shape annotation can be selected. If the return value is YES, the user can select the annotation by tapping on it. If the delegate does not implement this method, the default value isYES.DeclarationObjective-C - (BOOL)mapView:(nonnull MGLMapView *)mapView shapeAnnotationIsEnabled:(nonnull MGLShape *)annotation;Swift optional func mapView(_ mapView: MGLMapView, shapeAnnotationIsEnabled annotation: MGLShape) -> BoolParametersmapViewThe map view that has selected the annotation. annotationThe object representing the shape annotation. Return ValueA Boolean value indicating whether the annotation can be selected. 
- 
                                -mapView:didSelectAnnotation:Tells the delegate that one of its annotations was selected. You can use this method to track changes in the selection state of annotations. If the annotation is associated with an annotation view, you can also implement -mapView:didSelectAnnotationView:, which is called immediately after this method is called.Related examplesSee the Dynamically style interactive points example to learn how to remove an annotation view if it has already been selected. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didSelectAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)ParametersmapViewThe map view containing the annotation. annotationThe annotation that was selected. 
- 
                                -mapView:didDeselectAnnotation:Tells the delegate that one of its annotations was deselected. You can use this method to track changes in the selection state of annotations. If the annotation is associated with an annotation view, you can also implement -mapView:didDeselectAnnotationView:, which is called immediately after this method is called.DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didDeselectAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, didDeselect annotation: MGLAnnotation)ParametersmapViewThe map view containing the annotation. annotationThe annotation that was deselected. 
- 
                                
                                Tells the delegate that one of its annotation views was selected. You can use this method to track changes in the selection state of annotation views. This method is only called for annotation views. To track changes in the selection state of all annotations, including those associated with static annotation images, implement -mapView:didSelectAnnotation:, which is called immediately before this method is called.DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didSelectAnnotationView:(nonnull MGLAnnotationView *)annotationView;Swift optional func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView)ParametersmapViewThe map view containing the annotation. annotationViewThe annotation view that was selected. 
- 
                                -mapView:didDeselectAnnotationView:Tells the delegate that one of its annotation views was deselected. You can use this method to track changes in the selection state of annotation views. This method is only called for annotation views. To track changes in the selection state of all annotations, including those associated with static annotation images, implement -mapView:didDeselectAnnotation:, which is called immediately before this method is called.DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView didDeselectAnnotationView:(nonnull MGLAnnotationView *)annotationView;Swift optional func mapView(_ mapView: MGLMapView, didDeselect annotationView: MGLAnnotationView)ParametersmapViewThe map view containing the annotation. annotationViewThe annotation view that was deselected. 
- 
                                -mapView:annotationCanShowCallout:Returns a Boolean value indicating whether the annotation is able to display extra information in a callout bubble. This method is called after an annotation is selected, before any callout is displayed for the annotation. If the return value is YES, a callout view is shown when the user taps on an annotation, selecting it. The default callout displays the annotation’s title and subtitle. You can add accessory views to either end of the callout by implementing the-mapView:leftCalloutAccessoryViewForAnnotation:and-mapView:rightCalloutAccessoryViewForAnnotation:methods. You can further customize the callout’s contents by implementing the-mapView:calloutViewForAnnotation:method.If the return value is NO, or if this method is absent from the delegate, or if the annotation lacks a title, the annotation will not show a callout even when selected.Related examplesSee the Add annotation views and images, Display custom views as callouts, and Default callout usage examples to learn how to show callouts for MGLAnnotationobjects.DeclarationObjective-C - (BOOL)mapView:(nonnull MGLMapView *)mapView annotationCanShowCallout:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> BoolParametersmapViewThe map view that has selected the annotation. annotationThe object representing the annotation. Return ValueA Boolean value indicating whether the annotation should show a callout. 
- 
                                -mapView:calloutViewForAnnotation:Returns a callout view to display for the given annotation. If this method is present in the delegate, it must return a new instance of a view dedicated to display the callout. The returned view will be configured by the map view. If this method is absent from the delegate, or if it returns nil, a standard, two-line, bubble-like callout view is displayed by default.Related examplesSee the Display custom views as callouts example to learn how to customize an MGLAnnotationobject’sMGLCalloutView.DeclarationObjective-C - (nullable id<MGLCalloutView>)mapView:(nonnull MGLMapView *)mapView calloutViewForAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, calloutViewFor annotation: MGLAnnotation) -> MGLCalloutView?ParametersmapViewThe map view that requested the callout view. annotationThe object representing the annotation. Return ValueA view conforming to the MGLCalloutViewprotocol, ornilto use the default callout view.
- 
                                -mapView:leftCalloutAccessoryViewForAnnotation:Returns the view to display on the left side of the standard callout bubble. The left callout view is typically used to convey information about the annotation or to link to custom information provided by your application. If the view you specify is a descendant of the UIControlclass, you can use the map view’s delegate to receive notifications when your control is tapped, by implementing the-mapView:annotation:calloutAccessoryControlTapped:method. If the view you specify does not descend fromUIControl, your view is responsible for handling any touch events within its bounds.If this method is absent from the delegate, or if it returns nil, the standard callout view has no accessory view on its left side. The return value of this method is ignored if-mapView:calloutViewForAnnotation:is present in the delegate.To display a view on the callout’s right side, implement the -mapView:rightCalloutAccessoryViewForAnnotation:method.Related examplesSee the Default callout usage example to learn how to modify the view that is displayed on the left side of the standard callout bubble. DeclarationObjective-C - (nullable UIView *)mapView:(nonnull MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, leftCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView?ParametersmapViewThe map view presenting the annotation callout. annotationThe object representing the annotation with the callout. Return ValueThe accessory view to display. 
- 
                                -mapView:rightCalloutAccessoryViewForAnnotation:Returns the view to display on the right side of the standard callout bubble. The right callout view is typically used to convey information about the annotation or to link to custom information provided by your application. If the view you specify is a descendant of the UIControlclass, you can use the map view’s delegate to receive notifications when your control is tapped, by implementing the-mapView:annotation:calloutAccessoryControlTapped:method. If the view you specify does not descend fromUIControl, your view is responsible for handling any touch events within its bounds.If this method is absent from the delegate, or if it returns nil, the standard callout view has no accessory view on its right side. The return value of this method is ignored if-mapView:calloutViewForAnnotation:is present in the delegate.To display a view on the callout’s left side, implement the -mapView:leftCalloutAccessoryViewForAnnotation:method.Related examplesSee the Default callout usage example to learn how to modify the view that is displayed on the right side of the standard callout bubble. DeclarationObjective-C - (nullable UIView *)mapView:(nonnull MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation: (nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, rightCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView?ParametersmapViewThe map view presenting the annotation callout. annotationThe object representing the annotation with the callout. Return ValueThe accessory view to display. 
- 
                                -mapView:annotation:calloutAccessoryControlTapped:Tells the delegate that the user tapped one of the accessory controls in the annotation’s callout view. In a standard callout view, accessory views contain custom content and are positioned on either side of the annotation title text. If an accessory view you specify is a descendant of the UIControlclass, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displays additional information about the annotation, you could use this method to present a modal panel with that information.If your custom accessory views are not descendants of the UIControlclass, the map view does not call this method. If the annotation has a custom callout view via the-mapView:calloutViewForAnnotation:method, you can specify the custom accessory views using theMGLCalloutViewprotocol’sleftAccessoryViewandrightAccessoryViewproperties.Related examplesSee the Default callout usage example to learn how to trigger an action when the standard callout bubble’s accessory control is tapped. DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView annotation:(nonnull id<MGLAnnotation>)annotation calloutAccessoryControlTapped:(nonnull UIControl *)control;Swift optional func mapView(_ mapView: MGLMapView, annotation: MGLAnnotation, calloutAccessoryControlTapped control: UIControl)ParametersmapViewThe map view containing the specified annotation. annotationThe annotation whose accessory view was tapped. controlThe control that was tapped. 
- 
                                -mapView:tapOnCalloutForAnnotation:Tells the delegate that the user tapped on an annotation’s callout view. This method is called when the user taps on the body of the callout view, as opposed to the callout’s left or right accessory view. If the annotation has a custom callout view via the -mapView:calloutViewForAnnotation:method, this method is only called whenever the callout view calls its delegate’s-[MGLCalloutViewDelegate calloutViewTapped:]method.If this method is present on the delegate, the standard callout view’s body momentarily highlights when the user taps it, whether or not this method does anything in response to the tap. Related examplesSee the Display custom views as callouts example to learn how to trigger an action when an MGLAnnotationsMGLCalloutViewis tapped.DeclarationObjective-C - (void)mapView:(nonnull MGLMapView *)mapView tapOnCalloutForAnnotation:(nonnull id<MGLAnnotation>)annotation;Swift optional func mapView(_ mapView: MGLMapView, tapOnCalloutFor annotation: MGLAnnotation)ParametersmapViewThe map view containing the specified annotation. annotationThe annotation whose callout was tapped. 
MGLMapSnapshot
              @interface MGLMapSnapshot : NSObjectAn image generated by a snapshotter object.
- 
                                -pointForCoordinate:Converts the specified map coordinate to a point in the coordinate space of the image. DeclarationObjective-C - (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate;Swift func point(for coordinate: CLLocationCoordinate2D) -> CGPoint
- 
                                -coordinateForPoint:Converts the specified image point to a map coordinate. DeclarationObjective-C - (CLLocationCoordinate2D)coordinateForPoint:(CGPoint)point;Swift func coordinate(for point: CGPoint) -> CLLocationCoordinate2D
- 
                                imageThe image of the map’s content. DeclarationObjective-C @property (nonatomic, readonly) UIImage *_Nonnull image;Swift var image: UIImage { get }
MGLMapSnapshotOptions
                        @interface MGLMapSnapshotOptions : NSObject <NSCopying>The options to use when creating images with the
                              MGLMapSnapshotter.
                            
- 
                                  -initWithStyleURL:camera:size:Creates a set of options with the minimum required information. DeclarationObjective-C - (nonnull instancetype)initWithStyleURL:(nullable NSURL *)styleURL camera:(nonnull MGLMapCamera *)camera size:(CGSize)size;Swift init(styleURL: URL?, camera: MGLMapCamera, size: CGSize)ParametersstyleURLURL of the map style to snapshot. The URL may be a full HTTP, HTTPS URL, canonical URL or a path to a local file relative to the application’s resource path. Specify nilfor the default style.sizeThe image size. 
- 
                                  styleURLURL of the map style to snapshot. DeclarationObjective-C @property (nonatomic, readonly) NSURL *_Nonnull styleURL;Swift var styleURL: URL { get }
- 
                                  zoomLevelThe zoom level. The default zoom level is 0. If this property is non-zero and the camera property is non-nil, the camera’s altitude is ignored in favor of this property’s value. DeclarationObjective-C @property (nonatomic) double zoomLevel;Swift var zoomLevel: Double { get set }
- 
                                  cameraA camera representing the viewport visible in the snapshot. If this property is non-nil and the coordinateBoundsproperty is set to a non-empty coordinate bounds, the camera’s center coordinate and altitude are ignored in favor of thecoordinateBoundsproperty.DeclarationObjective-C @property (nonatomic) MGLMapCamera *_Nonnull camera;Swift var camera: MGLMapCamera { get set }
- 
                                  coordinateBoundsThe coordinate rectangle that encompasses the bounds to capture. If this property is non-empty and the camera property is non-nil, the camera’s center coordinate and altitude are ignored in favor of this property’s value. DeclarationObjective-C @property (nonatomic) MGLCoordinateBounds coordinateBounds;Swift var coordinateBounds: MGLCoordinateBounds { get set }
Configuring the Image
- 
                                  sizeThe size of the output image, measured in points. DeclarationObjective-C @property (nonatomic, readonly) CGSize size;Swift var size: CGSize { get }
- 
                                  scaleThe scale of the output image. Defaults to the main screen scale. The minimum scale is 1. DeclarationObjective-C @property (nonatomic) CGFloat scale;Swift var scale: CGFloat { get set }
MGLMapSnapshotter
                                @interface MGLMapSnapshotter : NSObject <MGLStylable>An MGLMapSnapshotter generates static raster images of the map. Each snapshot
                          image depicts a portion of a map defined by an
                          MGLMapSnapshotOptions object
                          you provide. The snapshotter generates an
                          MGLMapSnapshot object
                          asynchronously, calling
                          MGLMapSnapshotterDelegate
                          methods if defined, then
                          passing it into a completion handler once tiles and other resources needed for
                          the snapshot are finished loading.
                        
You can change the snapshotter’s options at any time and reuse the snapshotter for multiple distinct snapshots; however, the snapshotter can only generate one snapshot at a time. If you need to generate multiple snapshots concurrently, create multiple snapshotter objects.
For an interactive map, use the
                          MGLMapView class. Both
                          MGLMapSnapshotter
                          and MGLMapView are compatible with
                          offline packs managed by the
                          MGLOfflineStorage class.
                        
From a snapshot, you can obtain an image and convert geographic coordinates to
                          the image’s coordinate space in order to superimpose markers and overlays. If
                          you do not need offline map functionality, you can use the Snapshot class in
                          MapboxStatic.swift to generate
                          static map images with overlays.
                        
Example
let camera = MGLMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude: -122.4365), altitude: 100, pitch: 20, heading: 0)
                                
                                let options = MGLMapSnapshotOptions(styleURL: MGLStyle.satelliteStreetsStyleURL, camera: camera, size: CGSize(width: 320, height: 480))
                                options.zoomLevel = 10
                                
                                let snapshotter = MGLMapSnapshotter(options: options)
                                snapshotter.start { (snapshot, error) in
                                    if let error = error {
                                        fatalError(error.localizedDescription)
                                    }
                                
                                    image = snapshot?.image
                                }
                                Related examples
See the 
                            Create a static map snapshot example to learn how to use the
                          MGLMapSnapshotter to generate a static image based on an
                          MGLMapView
                          object’s style, camera, and view bounds.
                        
MGLUserTrackingMode
enum MGLUserTrackingMode : NSUInteger {}The mode used to track the user location on the map. Used with
                              MGLMapView.userTrackingMode.
                            
Related examples
See the Switch between user tracking modes example to learn how to toggle modes and how each mode behaves.
- 
                                  MGLUserTrackingModeNoneThe map does not follow the user location. DeclarationObjective-C MGLUserTrackingModeNone = 0Swift case none = 0
- 
                                  MGLUserTrackingModeFollowThe map follows the user location. This tracking mode falls back to MGLUserTrackingModeNoneif the user pans the map view.DeclarationObjective-C MGLUserTrackingModeFollowSwift case follow = 1
- 
                                  MGLUserTrackingModeFollowWithHeadingThe map follows the user location and rotates when the heading changes. The default user location annotation displays a fan-shaped indicator with the current heading. The heading indicator represents the direction the device is facing, which is sized according to the reported accuracy. This tracking mode is disabled if the user pans the map view, but remains enabled if the user zooms in. If the user rotates the map view, this tracking mode will fall back to MGLUserTrackingModeFollow.DeclarationObjective-C MGLUserTrackingModeFollowWithHeadingSwift case followWithHeading = 2
- 
                                  MGLUserTrackingModeFollowWithCourseThe map follows the user location and rotates when the course changes. Course represents the direction in which the device is traveling. The default user location annotation shows a puck-shaped indicator that rotates as the course changes. This tracking mode is disabled if the user pans the map view, but remains enabled if the user zooms in. If the user rotates the map view, this tracking mode will fall back to MGLUserTrackingModeFollow.DeclarationObjective-C MGLUserTrackingModeFollowWithCourseSwift case followWithCourse = 3
