MTMapView
open class MTMapView : UIView, Sendable
extension MTMapView: MTControllable
extension MTMapView: MTNavigable
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
public private(set) var style: MTStyle? { get } -
Declaration
Swift
public private(set) var locationManager: MTLocationManager? { get set } -
Current options of the map object.
Declaration
Swift
public var options: MTMapOptions? -
Service responsible for gestures handling
Declaration
Swift
public var gestureService: MTGestureService! -
Delegate object responsible for event propagation
Declaration
Swift
public weak var delegate: MTMapViewDelegate? -
Boolean indicating whether map is initialized,
Declaration
Swift
public private(set) var isInitialized: Bool { get } -
Triggers when map initializes for the first time.
Declaration
Swift
public var didInitialize: (() -> Void)? -
Initializes the map with the frame.
Declaration
Swift
override public init(frame: CGRect) -
Initializes the map with the coder..
Declaration
Swift
required public init?(coder: NSCoder) -
Initializes the map with the frame, options and style.
Declaration
Swift
convenience public init( frame: CGRect, options: MTMapOptions, referenceStyle: MTMapReferenceStyle, styleVariant: MTMapStyleVariant? = nil ) -
Initializes the map with the options.
Declaration
Swift
convenience public init(options: MTMapOptions?) -
Initializes location tracking manager.
In order to track user location you have to initalize the MLLocationManager, add neccessary Privacy Location messages to info.plist, subscribe to MTLocationManagerDelegate and start location updates and/or request location once via locationManager property on MTMapView.
Declaration
Swift
public func initLocationTracking(using manager: CLLocationManager? = nil, accuracy: CLLocationAccuracy? = nil)Parameters
managerOptional external CLLocationManager to use.
accuracyOptional desired accuracy to use.
-
Declaration
Swift
open override func layoutSubviews() -
Reloads the map view.
Declaration
Swift
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") 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") 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
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
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") 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") 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 accesibility feature enabled, unless options includes essential: true.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") 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 accesibility feature, unless options includes essential: true.Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") 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") 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.
-
Sets the padding in pixels around the viewport.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") public func setPadding(_ options: MTPaddingOptions, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)Parameters
optionsCustom options to use.
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") 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") 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") 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") 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") 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") 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 the map’s pitch (tilt).
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") 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") 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
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") public func getPitch(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") 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") public func getCenter(completionHandler: @escaping (Result<CLLocationCoordinate2D, MTError>) -> Void) -
Project coordinates to point on the container.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") 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") 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") 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
public func setBearing(_ bearing: Double) asyncParameters
bearingThe desired bearing.
-
setCenter(_:Asynchronous) Sets the map’s geographical centerpoint.
Declaration
Swift
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 accesibility feature enabled, unless options includes essential: true.Declaration
Swift
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 accesibility feature, unless options includes essential: true.Declaration
Swift
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
public func jumpTo(_ center: CLLocationCoordinate2D, options: MTCameraOptions?) async -
setPadding(_:Asynchronous) Sets the padding in pixels around the viewport.
Declaration
Swift
public func setPadding(_ options: MTPaddingOptions) 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
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
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
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
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
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
public func setMinZoom(_ minZoom: Double?) async throwsParameters
minZoomThe minimum zoom level to set (-2 - 24).
-
setPitch(_:Asynchronous) Sets the map’s pitch (tilt).
Declaration
Swift
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
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
public func getPitch() async -> Double -
panBy(_:Asynchronous) Pans the map by the specified offset.
Declaration
Swift
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
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
public func getCenter() async -> CLLocationCoordinate2D -
project(coordinates:Asynchronous) Project coordinates to point on the container.
Declaration
Swift
public func project(coordinates: CLLocationCoordinate2D) async -> MTPointParameters
coordinatesThe location to project.
-
getBearing()AsynchronousReturns the map’s current bearing.
Declaration
Swift
public func getBearing() async -> Double -
getRoll()AsynchronousReturns the map’s current roll.
Declaration
Swift
public func getRoll() async -> Double -
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") 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") 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") 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") 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") 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") 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") 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") 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.
-
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") 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") 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.
-
Enables the globe projection visualization.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") 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") 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") 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") 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") 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") 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 the map is fully loaded.
Declaration
Swift
@available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling") public func isMapLoaded( completionHandler: ((Result<Bool, MTError>) -> Void)? = nil )Parameters
completionHandlerA handler block to execute when function finishes.
-
setGlyphs(url:Asynchronousoptions: ) Sets the value of the style’s glyphs property.
Declaration
Swift
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
public func setLanguage(_ language: MTLanguage) asyncParameters
languageThe language to be applied.
-
setLight(_:Asynchronousoptions: ) Sets the any combination of light values.
Declaration
Swift
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
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
public func setShouldRenderWorldCopies(_ shouldRenderWorldCopies: Bool) asyncParameters
shouldRenderWorldCopiesBoolean indicating whether world copies should be rendered.
-
addMarker(_:Asynchronous) Adds a marker to the map.
Declaration
Swift
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
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
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
public func removeMarkers(_ markers: [MTMarker]) asyncParameters
markersMarkers to be removed from the map.
-
addTextPopup(_:Asynchronous) Adds a text popup to the map.
Declaration
Swift
public func addTextPopup(_ popup: MTTextPopup) asyncParameters
popupPopup to be added to the map.
-
removeTextPopup(_:Asynchronous) Removes a text popup from the map.
Declaration
Swift
public func removeTextPopup(_ popup: MTTextPopup) asyncParameters
markerPopup to be removed from the map.
-
enableGlobeProjection()AsynchronousEnables the globe projection visualization.
Declaration
Swift
public func enableGlobeProjection() async -
enableMercatorProjection()AsynchronousEnables the mercator projection visualization.
Declaration
Swift
public func enableMercatorProjection() async -
enableTerrain(exaggerationFactor:Asynchronous) Enables the 3D terrain visualization.
Note
Default is 1.Declaration
Swift
public func enableTerrain(exaggerationFactor: Double = 1.0) asyncParameters
exaggerationFactorFactor for volume boosting.
-
disableTerrain()AsynchronousDisables the 3D terrain visualization.
Declaration
Swift
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
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
public func setHalo(_ halo: MTHaloOption) asyncParameters
haloHalo configuration or a boolean to enable default.
-
disableHaloAnimations()AsynchronousDisables state transitions/animations for halo updates.
Declaration
Swift
public func disableHaloAnimations() async -
disableSpaceAnimations()AsynchronousDisables state transitions/animations for space updates.
Declaration
Swift
public func disableSpaceAnimations() async -
isSourceLoaded(id:Asynchronous) Returns boolean value indicating whether the source with provided id is loaded.
Declaration
Swift
public func isSourceLoaded(id: String) async -> BoolParameters
idThe id of the source.
-
isMapLoaded()AsynchronousReturns boolean value indicating whether the map is fully loaded.
Declaration
Swift
public func isMapLoaded() 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") 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") 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") 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") 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
public func zoomIn() async -
zoomOut()AsynchronousDecreases the map’s zoom level by 1.
Declaration
Swift
public func zoomOut() async -
getZoom()AsynchronousReturns the map’s current zoom level.
Declaration
Swift
public func getZoom() async -> Double -
setZoom(_:Asynchronous) Sets the map’s zoom level.
Declaration
Swift
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
func pinToSuperviewEdges()