MTMapView
@MainActor
open class MTMapView : UIView, Sendable
extension MTMapView: MTControllable
extension MTMapView: MTNavigable
extension MTMapView: MTRendering
extension MTMapView: MTStylable
extension MTMapView: MTZoomable
extension MTMapView: MTLocationManagerDelegate
Object representing the map on the screen.
Exposes methods and properties that enable changes to the map, and fires events that can be interacted with.
-
Proxy style object of the map.
Declaration
Swift
@MainActor public private(set) var style: MTStyle? { get } -
Undocumented
Declaration
Swift
@MainActor public private(set) var locationManager: MTLocationManager? { get set } -
Current options of the map object.
Declaration
Swift
@MainActor public var options: MTMapOptions? -
Service responsible for gestures handling
Declaration
Swift
@MainActor public var gestureService: MTGestureService! -
Delegate object responsible for event propagation
Declaration
Swift
@MainActor public weak var delegate: MTMapViewDelegate? -
Boolean indicating whether map is initialized,
Declaration
Swift
@MainActor public private(set) var isInitialized: Bool { get } -
Triggers when map initializes for the first time.
Declaration
Swift
@MainActor public var didInitialize: (() -> Void)? -
Initializes the map with the frame.
Declaration
Swift
@MainActor override public init(frame: CGRect) -
Initializes the map with the coder.
Declaration
Swift
@MainActor required public init?(coder: NSCoder) -
Initializes the map with the frame, options and style.
Declaration
Swift
@MainActor convenience public init( frame: CGRect, options: MTMapOptions, referenceStyle: MTMapReferenceStyle, styleVariant: MTMapStyleVariant? = nil ) -
Initializes the map with the options.
Declaration
Swift
@MainActor convenience public init(options: MTMapOptions?) -
Initializes location tracking manager.
In order to track user location you have to initialize the MLLocationManager, add necessary Privacy Location messages to Info.plist, subscribe to MTLocationManagerDelegate and start location updates and/or request location once via the locationManager property on MTMapView.
Declaration
Swift
@MainActor public func initLocationTracking(using manager: CLLocationManager? = nil, accuracy: CLLocationAccuracy? = nil)Parameters
managerOptional external CLLocationManager to use.
accuracyOptional desired accuracy to use.
-
Undocumented
Declaration
Swift
@MainActor open override func layoutSubviews() -
Reloads the map view.
Declaration
Swift
@MainActor public func reload() -
Adds Maptiler logo to the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func addMapTilerLogoControl( position: MTMapCorner, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
positionThe corner position of the logo.
completionHandlerA handler block to execute when function finishes.
-
Adds logo control to the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func addLogoControl( name: String, logoURL: URL, linkURL: URL, position: MTMapCorner, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
nameUnique name of the logo.
logoURLURL of logo image.
linkURLURL of logo link.
positionThe corner position of the logo.
completionHandlerA handler block to execute when function finishes.
-
addMapTilerLogoControl(position:Asynchronous) Adds Maptiler logo to the map.
Declaration
Swift
@MainActor public func addMapTilerLogoControl(position: MTMapCorner) asyncParameters
nameUnique name of the logo.
positionThe corner position of the logo.
-
addLogoControl(name:AsynchronouslogoURL: linkURL: position: ) Adds logo control to the map.
Declaration
Swift
@MainActor public func addLogoControl(name: String, logoURL: URL, linkURL: URL, position: MTMapCorner) asyncParameters
nameUnique name of the logo.
logoURLURL of logo image.
linkURLURL of logo link.
positionThe corner position of the logo.
-
Sets the bearing of the map.
The bearing is the compass direction that is “up”; for example, a bearing of 90° orients the map so that east is up.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setBearing(_ bearing: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
bearingThe desired bearing.
completionHandlerA handler block to execute when function finishes.
-
Sets the map’s geographical centerpoint.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setCenter( _ center: CLLocationCoordinate2D, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
centerThe desired center coordinate.
completionHandlerA handler block to execute when function finishes.
-
Changes any combination of center, zoom, bearing, and pitch.
The animation seamlessly incorporates zooming and panning to help the user maintain her bearings even after traversing a great distance.
Note
The animation will be skipped, and this will behave equivalently to jumpTo if the user has the reduced motion accessibility feature enabled, unless options includes essential: true.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func flyTo( _ center: CLLocationCoordinate2D, options: MTFlyToOptions?, animationOptions: MTAnimationOptions?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
centerThe desired center coordinate.
optionsCustom options to use.
animationOptionsOptional animation options to use.
completionHandlerA handler block to execute when function finishes.
-
Changes any combination of center, zoom, bearing, pitch, and padding.
The map will retain its current values for any details not specified in options.
Note
The transition will happen instantly if the user has enabled the reduced motion accessibility feature, unless options includes essential: true.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func easeTo( _ center: CLLocationCoordinate2D, options: MTCameraOptions?, animationOptions: MTAnimationOptions?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
centerThe desired center coordinate.
optionsCustom options to use.
animationOptionsOptional animation options to use.
completionHandlerA handler block to execute when function finishes.
-
Changes any combination of center, zoom, bearing, and pitch, without an animated transition.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func jumpTo( _ center: CLLocationCoordinate2D, options: MTCameraOptions?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
centerThe desired center coordinate.
optionsCustom options to use.
completionHandlerA handler block to execute when function finishes.
-
Fits the map so the provided bounds are fully visible within the viewport.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func fitBounds( _ bounds: MTBounds, options fitOptions: MTFitBoundsOptions? = nil, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
boundsGeographic bounds to display.
fitOptionsAdditional configuration that controls the fitting animation.
completionHandlerA handler block to execute when function finishes.
-
Sets the padding in pixels around the viewport.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setPadding(_ options: MTPaddingOptions, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
optionsCustom options to use.
completionHandlerA handler block to execute when function finishes.
-
Fits the map to the bounds inferred from the current IP address.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func fitToIpBounds(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Centers the map on the location inferred from the current IP address.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func centerOnIpPoint(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Sets the value of centerClampedToGround.
If true, the elevation of the center point will automatically be set to the terrain elevation (or zero if terrain is not enabled). If false, the elevation of the center point will default to sea level and will not automatically update. Needs to be set to false to keep the camera above ground when pitch > 90 degrees.
Note
Defaults to true.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setIsCenterClampedToGround( _ isCenterClampedToGround: Bool, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
isCenterClampedToGroundThe boolean value indicating if center will be clamped to ground.
completionHandlerA handler block to execute when function finishes.
-
Sets the elevation of the map’s center point, in meters above sea level.
Note
Triggers the following events: moveStart and moveEnd.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setCenterElevation(_ elevation: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
elevationThe desired elevation.
completionHandlerA handler block to execute when function finishes.
-
Sets or clears the map’s maximum pitch.
If the map’s current pitch is higher than the new maximum, the map will pitch to the new maximum. If null is provided, the function removes the current maximum pitch (sets it to 60).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setMaxPitch(_ maxPitch: Double?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
maxPitchThe maximum pitch to set (0-85).
completionHandlerA handler block to execute when function finishes.
-
Sets or clears the map’s maximum zoom.
If the map’s current zoom level is higher than the new maximum, the map will zoom to the new maximum. If null or undefined is provided, the function removes the current maximum zoom (sets it to 22).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setMaxZoom(_ maxZoom: Double?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
maxZoomThe maximum zoom level to set.
completionHandlerA handler block to execute when function finishes.
-
Sets or clears the map’s minimum pitch.
If the map’s current pitch is lower than the new minimum, the map will pitch to the new minimum. If null is provided, the function removes the current minimum pitch (i.e. sets it to 0).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setMinPitch(_ minPitch: Double?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
minPitchThe minimum pitch to set (0-85)
completionHandlerA handler block to execute when function finishes.
-
Sets or clears the map’s minimum zoom.
If the map’s current zoom level is lower than the new minimum, the map will zoom to the new minimum. If null is provided, the function removes the current minimum zoom (i.e. sets it to -2).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setMinZoom(_ minZoom: Double?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
minZoomThe minimum zoom level to set (-2 - 24).
completionHandlerA handler block to execute when function finishes.
-
Sets or clears the map’s maximum bounds constraint.
Declaration
Parameters
boundsThe bounds to constrain panning to, or
nilto remove the constraint.completionHandlerA handler block to execute when function finishes.
-
Sets the map’s pitch (tilt).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setPitch(_ pitch: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
pitchThe pitch to set, measured in degrees away from the plane of the screen (0-60).
completionHandlerA handler block to execute when function finishes.
-
Sets the map’s roll angle.
Note
Triggers the following events: moveStart, moveEnd, rollStart, and rollEnd.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setRoll(_ roll: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
rollThe roll to set, measured in degrees about the camera boresight.
completionHandlerA handler block to execute when function finishes.
-
Set combination of center, bearing, pitch, roll and elevation.
Declaration
Swift
@MainActor public func setViewport(with cameraHelper: MTMapCameraHelper, zoomLevel: Double? = nil)Parameters
cameraHelperHelper to use for setting the viewport.
zoomLevelDesired zoom level to set.
-
Returns the map’s current pitch (tilt).
The map’s current pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getPitch(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s maximum pitch (tilt).
The map’s maximum pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getMaxPitch(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s maximum zoom.
The map’s maximum zoom level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getMaxZoom(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s minimum pitch (tilt).
The map’s minimum pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getMinPitch(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s minimum zoom.
The map’s minimum zoom level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getMinZoom(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Pans the map by the specified offset.
Declaration
Parameters
offsetThe x and y coordinates by which to pan the map.
completionHandlerA handler block to execute when function finishes.
-
Pans the map to the specified location with an animated transition.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func panTo( _ coordinates: CLLocationCoordinate2D, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
coordinatesThe location to pan the map to.
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s current center.
The map’s current geographical center.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getCenter(completionHandler: @escaping (Result<CLLocationCoordinate2D, MTError>) -> Void) -
Returns the map’s current geographic bounds.
Declaration
Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the maximum bounds constraint applied to the map, if any.
Declaration
Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns whether the map’s center is clamped to the ground.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getCenterClampedToGround(completionHandler: @escaping (Result<Bool, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the elevation of the map’s center point, in meters above sea level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getCenterElevation(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the elevation for the point where the camera is looking, in meters above sea level multiplied by exaggeration.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getCameraTargetElevation(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Project coordinates to point on the container.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func project( coordinates: CLLocationCoordinate2D, completionHandler: @escaping (Result<CLLocationCoordinate2D, MTError>) -> Void )Parameters
coordinatesThe location to project.
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s current bearing.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getBearing(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s current roll.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getRoll(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
setBearing(_:Asynchronous) Sets the bearing of the map.
The bearing is the compass direction that is “up”; for example, a bearing of 90° orients the map so that east is up.
Declaration
Swift
@MainActor public func setBearing(_ bearing: Double) asyncParameters
bearingThe desired bearing.
-
setCenter(_:Asynchronous) Sets the map’s geographical centerpoint.
Declaration
Swift
@MainActor public func setCenter(_ center: CLLocationCoordinate2D) asyncParameters
centerThe desired center coordinate.
-
flyTo(_:Asynchronousoptions: animationOptions: ) Changes any combination of center, zoom, bearing, and pitch.
The animation seamlessly incorporates zooming and panning to help the user maintain her bearings even after traversing a great distance.
Note
The animation will be skipped, and this will behave equivalently to jumpTo if the user has the reduced motion accessibility feature enabled, unless options includes essential: true.Declaration
Swift
@MainActor public func flyTo( _ center: CLLocationCoordinate2D, options: MTFlyToOptions?, animationOptions: MTAnimationOptions? ) asyncParameters
centerThe desired center coordinate.
optionsCustom options to use.
animationOptionsOptional animation options to use.
completionHandlerA handler block to execute when function finishes.
-
easeTo(_:Asynchronousoptions: animationOptions: ) Changes any combination of center, zoom, bearing, pitch, and padding.
The map will retain its current values for any details not specified in options.
Note
The transition will happen instantly if the user has enabled the reduced motion accessibility feature, unless options includes essential: true.Declaration
Swift
@MainActor public func easeTo( _ center: CLLocationCoordinate2D, options: MTCameraOptions?, animationOptions: MTAnimationOptions? ) asyncParameters
centerThe desired center coordinate.
optionsCustom options to use.
animationOptionsOptional animation options to use.
completionHandlerA handler block to execute when function finishes.
-
jumpTo(_:Asynchronousoptions: ) Changes any combination of center, zoom, bearing, and pitch, without an animated transition.
Declaration
Swift
@MainActor public func jumpTo(_ center: CLLocationCoordinate2D, options: MTCameraOptions?) async -
fitBounds(_:Asynchronousoptions: ) Fits the map so the provided bounds are fully visible within the viewport.
Declaration
Swift
@MainActor public func fitBounds(_ bounds: MTBounds, options fitOptions: MTFitBoundsOptions? = nil) asyncParameters
boundsGeographic bounds to display.
fitOptionsAdditional configuration that controls the fitting animation.
-
setPadding(_:Asynchronous) Sets the padding in pixels around the viewport.
Declaration
Swift
@MainActor public func setPadding(_ options: MTPaddingOptions) async -
fitToIpBounds()AsynchronousFits the map to the bounds inferred from the current IP address.
Declaration
Swift
@MainActor public func fitToIpBounds() async -
centerOnIpPoint()AsynchronousCenters the map on the location inferred from the current IP address.
Declaration
Swift
@MainActor public func centerOnIpPoint() async -
setIsCenterClampedToGround(_:Asynchronous) Sets the value of centerClampedToGround.
If true, the elevation of the center point will automatically be set to the terrain elevation (or zero if terrain is not enabled). If false, the elevation of the center point will default to sea level and will not automatically update. Needs to be set to false to keep the camera above ground when pitch > 90 degrees.
Note
Defaults to true.Declaration
Swift
@MainActor public func setIsCenterClampedToGround(_ isCenterClampedToGround: Bool) asyncParameters
isCenterClampedToGroundThe boolean value indicating if center will be clamped to ground.
-
setCenterElevation(_:Asynchronous) Sets the elevation of the map’s center point, in meters above sea level.
Note
Triggers the following events: moveStart and moveEnd.Declaration
Swift
@MainActor public func setCenterElevation(_ elevation: Double) asyncParameters
elevationThe desired elevation.
-
setMaxPitch(_:Asynchronous) Sets or clears the map’s maximum pitch.
If the map’s current pitch is higher than the new maximum, the map will pitch to the new maximum. If null is provided, the function removes the current maximum pitch (sets it to 60).
Throws
AMTErrorif maxPitch is out of bounds.Declaration
Swift
@MainActor public func setMaxPitch(_ maxPitch: Double?) async throwsParameters
maxPitchThe maximum pitch to set (0-85).
-
setMaxZoom(_:Asynchronous) Sets or clears the map’s maximum zoom.
If the map’s current zoom level is higher than the new maximum, the map will zoom to the new maximum. If null or undefined is provided, the function removes the current maximum zoom (sets it to 22).
Throws
AMTErrorif maxZoom is out of bounds.Declaration
Swift
@MainActor public func setMaxZoom(_ maxZoom: Double?) async throwsParameters
maxZoomThe maximum zoom level to set.
-
setMinPitch(_:Asynchronous) Sets or clears the map’s minimum pitch.
If the map’s current pitch is lower than the new minimum, the map will pitch to the new minimum. If null is provided, the function removes the current minimum pitch (i.e. sets it to 0).
Throws
AMTErrorif minPitch is out of bounds.Declaration
Swift
@MainActor public func setMinPitch(_ minPitch: Double?) async throwsParameters
minPitchThe minimum pitch to set (0-85)
-
setMinZoom(_:Asynchronous) Sets or clears the map’s minimum zoom.
If the map’s current zoom level is lower than the new minimum, the map will zoom to the new minimum. If null is provided, the function removes the current minimum zoom (i.e. sets it to -2).
Throws
AMTErrorif minZoom is out of bounds.Declaration
Swift
@MainActor public func setMinZoom(_ minZoom: Double?) async throwsParameters
minZoomThe minimum zoom level to set (-2 - 24).
-
setMaxBounds(_:Asynchronous) Sets or clears the map’s maximum bounds constraint.
Declaration
Swift
@MainActor public func setMaxBounds(_ bounds: MTBounds?) async throwsParameters
boundsThe bounds to constrain panning to, or
nilto remove the constraint. -
setPitch(_:Asynchronous) Sets the map’s pitch (tilt).
Declaration
Swift
@MainActor public func setPitch(_ pitch: Double) asyncParameters
pitchThe pitch to set, measured in degrees away from the plane of the screen (0-60).
-
setRoll(_:Asynchronous) Sets the map’s roll angle.
Note
Triggers the following events: moveStart, moveEnd, rollStart, and rollEnd.Declaration
Swift
@MainActor public func setRoll(_ roll: Double) asyncParameters
rollThe roll to set, measured in degrees about the camera boresight.
-
getPitch()AsynchronousReturns the map’s current pitch (tilt).
The map’s current pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@MainActor public func getPitch() async -> Double -
getMaxPitch()AsynchronousReturns the map’s maximum pitch (tilt).
The map’s maximum pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@MainActor public func getMaxPitch() async -> Double -
getMaxZoom()AsynchronousReturns the map’s maximum zoom.
The map’s maximum zoom level.
Declaration
Swift
@MainActor public func getMaxZoom() async -> Double -
getMinPitch()AsynchronousReturns the map’s minimum pitch (tilt).
The map’s minimum pitch, measured in degrees away from the plane of the screen.
Declaration
Swift
@MainActor public func getMinPitch() async -> Double -
getMinZoom()AsynchronousReturns the map’s minimum zoom.
The map’s minimum zoom level.
Declaration
Swift
@MainActor public func getMinZoom() async -> Double -
panBy(_:Asynchronous) Pans the map by the specified offset.
Declaration
Swift
@MainActor public func panBy(_ offset: MTPoint) asyncParameters
offsetThe x and y coordinates by which to pan the map.
-
panTo(_:Asynchronous) Pans the map to the specified location with an animated transition.
Declaration
Swift
@MainActor public func panTo(_ coordinates: CLLocationCoordinate2D) asyncParameters
coordinatesThe location to pan the map to.
-
getCenter()AsynchronousReturns the map’s current center.
The map’s current geographical center.
Declaration
Swift
@MainActor public func getCenter() async -> CLLocationCoordinate2D -
getBounds()AsynchronousReturns the map’s current geographic bounds.
Declaration
Swift
@MainActor public func getBounds() async -> MTBounds -
getMaxBounds()AsynchronousReturns the maximum bounds constraint applied to the map, if any.
Declaration
Swift
@MainActor public func getMaxBounds() async -> MTBounds? -
getCenterClampedToGround()AsynchronousReturns whether the map’s center point is clamped to the ground.
Declaration
Swift
@MainActor public func getCenterClampedToGround() async -> Bool -
getCenterElevation()AsynchronousReturns the elevation of the map’s center point, in meters above sea level.
Declaration
Swift
@MainActor public func getCenterElevation() async -> Double -
getCameraTargetElevation()AsynchronousReturns the elevation for the point where the camera is looking, in meters above sea level multiplied by exaggeration.
Declaration
Swift
@MainActor public func getCameraTargetElevation() async -> Double -
project(coordinates:Asynchronous) Project coordinates to point on the container.
Declaration
Swift
@MainActor public func project(coordinates: CLLocationCoordinate2D) async -> MTPointParameters
coordinatesThe location to project.
-
getBearing()AsynchronousReturns the map’s current bearing.
Declaration
Swift
@MainActor public func getBearing() async -> Double -
getRoll()AsynchronousReturns the map’s current roll.
Declaration
Swift
@MainActor public func getRoll() async -> Double -
Returns the pixel ratio currently used by the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getPixelRatio(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Sets the pixel ratio used by the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setPixelRatio( _ pixelRatio: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
pixelRatioPixel ratio value to apply.
completionHandlerA handler block to execute when function finishes.
-
getPixelRatio()AsynchronousReturns the pixel ratio currently used by the map.
Declaration
Swift
@MainActor public func getPixelRatio() async -> Double -
setPixelRatio(_:Asynchronous) Sets the pixel ratio used by the map.
Declaration
Swift
@MainActor public func setPixelRatio(_ pixelRatio: Double) asyncParameters
pixelRatioPixel ratio value to apply.
-
Sets the value of the style’s glyphs property.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setGlyphs( url: URL, options: MTStyleSetterOptions?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
urlURL of the Glyph
optionsSupporting type to add validation to another style related type.
completionHandlerA handler block to execute when function finishes.
-
Sets the map labels language.
The language generally depends on the style. Whenever a label is not supported in the defined language, it falls back to MTLanguage.latin.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setLanguage(_ language: MTLanguage, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
languageThe language to be applied.
completionHandlerA handler block to execute when function finishes.
-
Sets the any combination of light values.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setLight( _ light: MTLight, options: MTStyleSetterOptions?, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
lightLight properties to set.
optionsSupporting type to add validation to another style related type.
completionHandlerA handler block to execute when function finishes.
-
Sets the space background for globe projection (cubemap/spacebox).
Note
Make sure space is enabled and projection is set to Globe before initializing the map via MTMapOptions.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setSpace( _ space: MTSpaceOption, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
spaceSpace configuration or a boolean to enable default.
completionHandlerA handler block to execute when function finishes.
-
Sets the atmospheric halo (glow) around the globe.
Note
Make sure halo is enabled and projection is set to Globe before initializing the map via MTMapOptions.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setHalo( _ halo: MTHaloOption, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
haloHalo configuration or a boolean to enable default.
completionHandlerA handler block to execute when function finishes.
-
Disables state transitions/animations for halo updates.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func disableHaloAnimations( completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
Disables state transitions/animations for space updates.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func disableSpaceAnimations( completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
Sets the state of shouldRenderWorldCopies.
If true , multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to false: When the map is zoomed out far enough that a single representation of the world does not fill the map’s entire container, there will be blank space beyond 180 and -180 degrees longitude. When the map is zoomed out far enough that a single representation of the world does not fill the map’s entire container, there will be blank space beyond 180 and -180 degrees longitude. Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the map and the other on the left edge of the map) at every zoom level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setShouldRenderWorldCopies( _ shouldRenderWorldCopies: Bool, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
shouldRenderWorldCopiesBoolean indicating whether world copies should be rendered.
completionHandlerA handler block to execute when function finishes.
-
Registers an image with the current style so it can be referenced by layers and annotations.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func addImage( name: String, image: UIImage, options: MTStyleImageOptions? = nil, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
nameUnique identifier for the image.
imageImage to register.
optionsAdditional configuration that controls how the image is rendered.
completionHandlerA handler block to execute when function finishes.
-
Registers a sprite with the current style so it can be referenced by layers and annotations.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func addSprite( id: String, url: URL, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
idUnique identifier for the sprite.
urlURL pointing to the sprite resource.
completionHandlerA handler block to execute when function finishes.
-
Adds a marker to the map.
Declaration
Parameters
markerMarker to be added to the map.
completionHandlerA handler block to execute when function finishes.
-
Adds multiple markers to the map.
Batch adding is preferred way of adding multiple markers to the map.
Declaration
Parameters
markersMarkers to be added to the map.
withSingleIconOptional single image to use for all markers.
completionHandlerA handler block to execute when function finishes.
-
Removes a marker from the map.
Declaration
Parameters
markerMarker to be removed from the map.
completionHandlerA handler block to execute when function finishes.
-
Removes multiple markers from the map.
Batch removing is preferred way of removing multiple markers from the map.
Declaration
Parameters
markersMarkers to be removed from the map.
completionHandlerA handler block to execute when function finishes.
-
Adds a text popup to the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func addTextPopup(_ popup: MTTextPopup, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
popupPopup to be added to the map.
completionHandlerA handler block to execute when function finishes.
-
Removes a text popup from the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func removeTextPopup(_ popup: MTTextPopup, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
popupPopup to be removed from the map.
completionHandlerA handler block to execute when function finishes.
-
Returns the projection currently active on the map.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getProjection(completionHandler: ((Result<MTProjectionType, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Enables the globe projection visualization.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func enableGlobeProjection(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Enables the mercator projection visualization.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func enableMercatorProjection(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Enables the 3D terrain visualization.
Note
Default is 1.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func enableTerrain( exaggerationFactor: Double = 1.0, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
exaggerationFactorFactor for volume boosting.
completionHandlerA handler block to execute when function finishes.
-
Disables the 3D terrain visualization.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func disableTerrain(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Sets the map’s vertical field of view, in degrees.
The internal camera has a default vertical field of view of a wide ~36.86 degrees. In globe mode, such a large FOV reduces the amount of the Earth that can be seen at once and exaggerates the central part, comparably to a fisheye lens. In many cases, a narrower FOV is preferable.
Note
Default is 36.87.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setVerticalFieldOfView( degrees: Double = 36.87, completionHandler: ((Result<Void, MTError>) -> Void)? = nil )Parameters
degreesThe vertical field of view to set, in degrees (0-180).
completionHandlerA handler block to execute when function finishes.
-
Returns boolean value indicating whether the source with provided id is loaded.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func isSourceLoaded( id: String, completionHandler: ((Result<Bool, MTError>) -> Void)? = nil )Parameters
idThe id of the source.
completionHandlerA handler block to execute when function finishes.
-
Returns boolean value indicating whether all tiles required for the current viewport are loaded.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func areTilesLoaded( completionHandler: ((Result<Bool, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns boolean value indicating whether the map is fully loaded.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func isMapLoaded( completionHandler: ((Result<Bool, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns boolean value indicating whether the map renders world copies.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getRenderWorldCopies( completionHandler: ((Result<Bool, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
setFilter(forLayerId:Asynchronousfilter: ) Undocumented
Declaration
Swift
@MainActor public func setFilter(forLayerId layerId: String, filter: MTPropertyValue) async -
setLayoutProperty(forLayerId:Asynchronousname: value: ) Undocumented
Declaration
Swift
@MainActor public func setLayoutProperty(forLayerId layerId: String, name: String, value: MTPropertyValue) async -
setPaintProperty(forLayerId:Asynchronousname: value: ) Undocumented
Declaration
Swift
@MainActor public func setPaintProperty(forLayerId layerId: String, name: String, value: MTPropertyValue) async
-
setLayoutProperty(forLayerId:Asynchronousproperty: value: ) Sets a symbol layout property using a typed key (async).
Declaration
Swift
@MainActor public func setLayoutProperty( forLayerId layerId: String, property: MTSymbolLayoutProperty, value: MTPropertyValue ) asyncParameters
layerIdIdentifier of the target layer.
propertyTyped symbol layout property key.
valueProperty value or expression.
-
setPaintProperty(forLayerId:Asynchronousproperty: value: ) Sets a circle paint property using a typed key (async).
Declaration
Swift
@MainActor public func setPaintProperty( forLayerId layerId: String, property: MTCirclePaintProperty, value: MTPropertyValue ) asyncParameters
layerIdIdentifier of the target layer.
propertyTyped circle paint property key.
valueProperty value or expression.
-
setPaintProperty(forLayerId:Asynchronousproperty: value: ) Sets a symbol paint property using a typed key (async).
Declaration
Swift
@MainActor public func setPaintProperty( forLayerId layerId: String, property: MTSymbolPaintProperty, value: MTPropertyValue ) asyncParameters
layerIdIdentifier of the target layer.
propertyTyped symbol paint property key.
valueProperty value or expression.
-
setGlyphs(url:Asynchronousoptions: ) Sets the value of the style’s glyphs property.
Declaration
Swift
@MainActor public func setGlyphs(url: URL, options: MTStyleSetterOptions?) asyncParameters
urlURL of the Glyph
optionsSupporting type to add validation to another style related type.
-
setLanguage(_:Asynchronous) Sets the map labels language.
The language generally depends on the style. Whenever a label is not supported in the defined language, it falls back to MTLanguage.latin.
Declaration
Swift
@MainActor public func setLanguage(_ language: MTLanguage) asyncParameters
languageThe language to be applied.
-
setLight(_:Asynchronousoptions: ) Sets the any combination of light values.
Declaration
Swift
@MainActor public func setLight(_ light: MTLight, options: MTStyleSetterOptions?) asyncParameters
lightLight properties to set.
optionsSupporting type to add validation to another style related type.
-
setSpace(_:Asynchronous) Sets the space background for globe projection (cubemap/spacebox).
Note
Make sure space is enabled and projection is set to Globe before initializing the map via MTMapOptions.Declaration
Swift
@MainActor public func setSpace(_ space: MTSpaceOption) asyncParameters
spaceSpace configuration or a boolean to enable default.
-
setShouldRenderWorldCopies(_:Asynchronous) Sets the state of shouldRenderWorldCopies.
If true , multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to false: When the map is zoomed out far enough that a single representation of the world does not fill the map’s entire container, there will be blank space beyond 180 and -180 degrees longitude. When the map is zoomed out far enough that a single representation of the world does not fill the map’s entire container, there will be blank space beyond 180 and -180 degrees longitude. Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the map and the other on the left edge of the map) at every zoom level.
Declaration
Swift
@MainActor public func setShouldRenderWorldCopies(_ shouldRenderWorldCopies: Bool) asyncParameters
shouldRenderWorldCopiesBoolean indicating whether world copies should be rendered.
-
addImage(name:Asynchronousimage: options: ) Registers an image with the current style so it can be referenced by layers and annotations.
Declaration
Swift
@MainActor public func addImage(name: String, image: UIImage, options: MTStyleImageOptions? = nil) asyncParameters
nameUnique identifier for the image.
imageImage to register.
optionsAdditional configuration that controls how the image is rendered.
-
addSprite(id:Asynchronousurl: ) Registers a sprite with the current style so it can be referenced by layers and annotations.
Declaration
Swift
@MainActor public func addSprite(id: String, url: URL) asyncParameters
idUnique identifier for the sprite.
urlURL pointing to the sprite resource.
-
addMarker(_:Asynchronous) Adds a marker to the map.
Declaration
Swift
@MainActor public func addMarker(_ marker: MTMarker) asyncParameters
markerMarker to be added to the map.
-
addMarkers(_:AsynchronouswithSingleIcon: ) Adds multiple markers to the map.
Batch adding is preferred way of adding multiple markers to the map.
Declaration
Swift
@MainActor public func addMarkers(_ markers: [MTMarker], withSingleIcon: UIImage?) asyncParameters
markersMarkers to be added to the map.
withSingleIconOptional single image to use for all markers.
-
removeMarker(_:Asynchronous) Removes a marker from the map.
Declaration
Swift
@MainActor public func removeMarker(_ marker: MTMarker) asyncParameters
markerMarker to be removed from the map.
-
removeMarkers(_:Asynchronous) Removes multiple markers from the map.
Batch removing is preferred way of removing multiple markers from the map.
Declaration
Swift
@MainActor public func removeMarkers(_ markers: [MTMarker]) asyncParameters
markersMarkers to be removed from the map.
-
addTextPopup(_:Asynchronous) Adds a text popup to the map.
Declaration
Swift
@MainActor public func addTextPopup(_ popup: MTTextPopup) asyncParameters
popupPopup to be added to the map.
-
removeTextPopup(_:Asynchronous) Removes a text popup from the map.
Declaration
Swift
@MainActor public func removeTextPopup(_ popup: MTTextPopup) asyncParameters
markerPopup to be removed from the map.
-
getProjection()AsynchronousReturns the projection currently active on the map.
Declaration
Swift
@MainActor public func getProjection() async -> MTProjectionType -
enableGlobeProjection()AsynchronousEnables the globe projection visualization.
Declaration
Swift
@MainActor public func enableGlobeProjection() async -
enableMercatorProjection()AsynchronousEnables the mercator projection visualization.
Declaration
Swift
@MainActor public func enableMercatorProjection() async -
enableTerrain(exaggerationFactor:Asynchronous) Enables the 3D terrain visualization.
Note
Default is 1.Declaration
Swift
@MainActor public func enableTerrain(exaggerationFactor: Double = 1.0) asyncParameters
exaggerationFactorFactor for volume boosting.
-
disableTerrain()AsynchronousDisables the 3D terrain visualization.
Declaration
Swift
@MainActor public func disableTerrain() async -
setVerticalFieldOfView(degrees:Asynchronous) Sets the map’s vertical field of view, in degrees.
The internal camera has a default vertical field of view of a wide ~36.86 degrees. In globe mode, such a large FOV reduces the amount of the Earth that can be seen at once and exaggerates the central part, comparably to a fisheye lens. In many cases, a narrower FOV is preferable.
Note
Default is 36.87.Declaration
Swift
@MainActor public func setVerticalFieldOfView(degrees: Double = 36.87) asyncParameters
degreesThe vertical field of view to set, in degrees (0-180).
-
setHalo(_:Asynchronous) Sets the atmospheric halo (glow) around the globe.
Note
Make sure halo is enabled and projection is set to Globe before initializing the map via MTMapOptions.Declaration
Swift
@MainActor public func setHalo(_ halo: MTHaloOption) asyncParameters
haloHalo configuration or a boolean to enable default.
-
disableHaloAnimations()AsynchronousDisables state transitions/animations for halo updates.
Declaration
Swift
@MainActor public func disableHaloAnimations() async -
disableSpaceAnimations()AsynchronousDisables state transitions/animations for space updates.
Declaration
Swift
@MainActor public func disableSpaceAnimations() async -
isSourceLoaded(id:Asynchronous) Returns boolean value indicating whether the source with provided id is loaded.
Declaration
Swift
@MainActor public func isSourceLoaded(id: String) async -> BoolParameters
idThe id of the source.
-
areTilesLoaded()AsynchronousReturns boolean value indicating whether all tiles required for the current viewport are loaded.
Declaration
Swift
@MainActor public func areTilesLoaded() async -> Bool -
isMapLoaded()AsynchronousReturns boolean value indicating whether the map is fully loaded.
Declaration
Swift
@MainActor public func isMapLoaded() async -> Bool -
getRenderWorldCopies()AsynchronousReturns boolean value indicating whether the map renders world copies.
Declaration
Swift
@MainActor public func getRenderWorldCopies() async -> Bool -
Increases the map’s zoom level by 1.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func zoomIn(completionHandler: ((Result<Void, MTError>) -> Void)? = nil) -
Decreases the map’s zoom level by 1.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func zoomOut(completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
completionHandlerA handler block to execute when function finishes.
-
Returns the map’s current zoom level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func getZoom(completionHandler: @escaping (Result<Double, MTError>) -> Void)Parameters
completionHandlerA handler block to execute when function finishes.
-
Sets the map’s zoom level.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") @MainActor public func setZoom(_ zoom: Double, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
zoomThe zoom level to set (0-20).
completionHandlerA handler block to execute when function finishes.
-
zoomIn()AsynchronousIncreases the map’s zoom level by 1.
Declaration
Swift
@MainActor public func zoomIn() async -
zoomOut()AsynchronousDecreases the map’s zoom level by 1.
Declaration
Swift
@MainActor public func zoomOut() async -
getZoom()AsynchronousReturns the map’s current zoom level.
Declaration
Swift
@MainActor public func getZoom() async -> Double -
setZoom(_:Asynchronous) Sets the map’s zoom level.
Declaration
Swift
@MainActor public func setZoom(_ zoom: Double) async -
Declaration
Swift
@MainActor public func didUpdateLocation(_ location: CLLocation) -
Declaration
Swift
@MainActor public func didFailWithError(_ error: Error) -
Pins the map view to its superview edges using auto layout.
Note
Map view must be added to the superview before calling the function.Declaration
Swift
@MainActor func pinToSuperviewEdges()