MTMapView

@MainActor
open class MTMapView : UIView
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

    @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 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

    @MainActor
    public func initLocationTracking(using manager: CLLocationManager? = nil, accuracy: CLLocationAccuracy? = nil)

    Parameters

    manager

    Optional external CLLocationManager to use.

    accuracy

    Optional 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

    position

    The corner position of the logo.

    completionHandler

    A 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(
        logoURL: URL,
        linkURL: URL,
        position: MTMapCorner,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    logoURL

    URL of logo image.

    linkURL

    URL of logo link.

    position

    The corner position of the logo.

    completionHandler

    A handler block to execute when function finishes.

  • Adds Maptiler logo to the map.

    Declaration

    Swift

    @MainActor
    public func addMapTilerLogoControl(position: MTMapCorner) async

    Parameters

    position

    The corner position of the logo.

  • Adds logo control to the map.

    Declaration

    Swift

    @MainActor
    public func addLogoControl(logoURL: URL, linkURL: URL, position: MTMapCorner) async

    Parameters

    logoURL

    URL of logo image.

    linkURL

    URL of logo link.

    position

    The 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

    bearing

    The desired bearing.

    completionHandler

    A 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

    center

    The desired center coordinate.

    completionHandler

    A 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")
    @MainActor
    public func flyTo(
        _ center: CLLocationCoordinate2D,
        options: MTFlyToOptions?,
        animationOptions: MTAnimationOptions?,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    center

    The desired center coordinate.

    options

    Custom options to use.

    animationOptions

    Optional animation options to use.

    completionHandler

    A 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")
    @MainActor
    public func easeTo(
        _ center: CLLocationCoordinate2D,
        options: MTCameraOptions?,
        animationOptions: MTAnimationOptions?,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    center

    The desired center coordinate.

    options

    Custom options to use.

    animationOptions

    Optional animation options to use.

    completionHandler

    A 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

    center

    The desired center coordinate.

    options

    Custom options to use.

    completionHandler

    A 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

    options

    Custom options to use.

    completionHandler

    A 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

    isCenterClampedToGround

    The boolean value indicating if center will be clamped to ground.

    completionHandler

    A 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

    elevation

    The desired elevation.

    completionHandler

    A 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

    maxPitch

    The maximum pitch to set (0-85).

    completionHandler

    A 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

    maxZoom

    The maximum zoom level to set.

    completionHandler

    A 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

    minPitch

    The minimum pitch to set (0-85)

    completionHandler

    A 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

    minZoom

    The minimum zoom level to set (-2 - 24).

    completionHandler

    A 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

    pitch

    The pitch to set, measured in degrees away from the plane of the screen (0-60).

    completionHandler

    A 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

    roll

    The roll to set, measured in degrees about the camera boresight.

    completionHandler

    A 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

    cameraHelper

    Helper to use for setting the viewport.

    zoomLevel

    Desired 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

    completionHandler

    A handler block to execute when function finishes.

  • Pans the map by the specified offset.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func panBy(_ offset: MTPoint, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)

    Parameters

    offset

    The x and y coordinates by which to pan the map.

    completionHandler

    A 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

    coordinates

    The location to pan the map to.

    completionHandler

    A 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)
  • 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) async

    Parameters

    bearing

    The desired bearing.

  • setCenter(_:) Asynchronous

    Sets the map’s geographical centerpoint.

    Declaration

    Swift

    @MainActor
    public func setCenter(_ center: CLLocationCoordinate2D) async

    Parameters

    center

    The desired center coordinate.

  • 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

    @MainActor
    public func flyTo(
        _ center: CLLocationCoordinate2D,
        options: MTFlyToOptions?,
        animationOptions: MTAnimationOptions?
    ) async

    Parameters

    center

    The desired center coordinate.

    options

    Custom options to use.

    animationOptions

    Optional animation options to use.

    completionHandler

    A 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

    @MainActor
    public func easeTo(
        _ center: CLLocationCoordinate2D,
        options: MTCameraOptions?,
        animationOptions: MTAnimationOptions?
    ) async

    Parameters

    center

    The desired center coordinate.

    options

    Custom options to use.

    animationOptions

    Optional animation options to use.

    completionHandler

    A handler block to execute when function finishes.

  • jumpTo(_:options:) Asynchronous

    Changes any combination of center, zoom, bearing, and pitch, without an animated transition.

    Declaration

    Swift

    @MainActor
    public func jumpTo(_ center: CLLocationCoordinate2D, options: MTCameraOptions?) async
  • setPadding(_:) Asynchronous

    Sets the padding in pixels around the viewport.

    Declaration

    Swift

    @MainActor
    public func setPadding(_ options: MTPaddingOptions) async
  • 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) async

    Parameters

    isCenterClampedToGround

    The 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) async

    Parameters

    elevation

    The 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

    A MTError if maxPitch is out of bounds.

    Declaration

    Swift

    @MainActor
    public func setMaxPitch(_ maxPitch: Double?) async throws

    Parameters

    maxPitch

    The 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

    A MTError if maxZoom is out of bounds.

    Declaration

    Swift

    @MainActor
    public func setMaxZoom(_ maxZoom: Double?) async throws

    Parameters

    maxZoom

    The 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

    A MTError if minPitch is out of bounds.

    Declaration

    Swift

    @MainActor
    public func setMinPitch(_ minPitch: Double?) async throws

    Parameters

    minPitch

    The 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

    A MTError if minZoom is out of bounds.

    Declaration

    Swift

    @MainActor
    public func setMinZoom(_ minZoom: Double?) async throws

    Parameters

    minZoom

    The minimum zoom level to set (-2 - 24).

  • setPitch(_:) Asynchronous

    Sets the map’s pitch (tilt).

    Declaration

    Swift

    @MainActor
    public func setPitch(_ pitch: Double) async

    Parameters

    pitch

    The 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) async

    Parameters

    roll

    The roll to set, measured in degrees about the camera boresight.

  • getPitch() Asynchronous

    Returns 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
  • panBy(_:) Asynchronous

    Pans the map by the specified offset.

    Declaration

    Swift

    @MainActor
    public func panBy(_ offset: MTPoint) async

    Parameters

    offset

    The 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) async

    Parameters

    coordinates

    The location to pan the map to.

  • getCenter() Asynchronous

    Returns the map’s current center.

    The map’s current geographical center.

    Declaration

    Swift

    @MainActor
    public func getCenter() async -> CLLocationCoordinate2D
  • 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

    url

    URL of the Glyph

    options

    Supporting type to add validation to another style related type.

    completionHandler

    A 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

    language

    The language to be applied.

    completionHandler

    A 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

    light

    Light properties to set.

    options

    Supporting type to add validation to another style related type.

    completionHandler

    A 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

    shouldRenderWorldCopies

    Boolean indicating whether world copies should be rendered.

    completionHandler

    A handler block to execute when function finishes.

  • Adds a marker to the map.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func addMarker(_ marker: MTMarker, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)

    Parameters

    marker

    Marker to be added to the map.

    completionHandler

    A 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

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func addMarkers(
        _ markers: [MTMarker],
        withSingleIcon: UIImage?,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    markers

    Markers to be added to the map.

    withSingleIcon

    Optional single image to use for all markers.

    completionHandler

    A handler block to execute when function finishes.

  • Removes a marker from the map.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func removeMarker(_ marker: MTMarker, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)

    Parameters

    marker

    Marker to be removed from the map.

    completionHandler

    A 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

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func removeMarkers(_ markers: [MTMarker], completionHandler: ((Result<Void, MTError>) -> Void)? = nil)

    Parameters

    markers

    Markers to be removed from the map.

    completionHandler

    A 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

    popup

    Popup to be added to the map.

    completionHandler

    A 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

    popup

    Popup to be removed from the map.

    completionHandler

    A 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

    completionHandler

    A 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

    completionHandler

    A 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

    exaggerationFactor

    Factor for volume boosting.

    completionHandler

    A 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

    completionHandler

    A 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

    degrees

    The vertical field of view to set, in degrees (0-180).

    completionHandler

    A 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

    id

    The id of the source.

    completionHandler

    A 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

    completionHandler

    A handler block to execute when function finishes.

  • Sets the value of the style’s glyphs property.

    Declaration

    Swift

    @MainActor
    public func setGlyphs(url: URL, options: MTStyleSetterOptions?) async

    Parameters

    url

    URL of the Glyph

    options

    Supporting 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) async

    Parameters

    language

    The language to be applied.

  • setLight(_:options:) Asynchronous

    Sets the any combination of light values.

    Declaration

    Swift

    @MainActor
    public func setLight(_ light: MTLight, options: MTStyleSetterOptions?) async

    Parameters

    light

    Light properties to set.

    options

    Supporting type to add validation to another style related type.

  • 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) async

    Parameters

    shouldRenderWorldCopies

    Boolean indicating whether world copies should be rendered.

  • addMarker(_:) Asynchronous

    Adds a marker to the map.

    Declaration

    Swift

    @MainActor
    public func addMarker(_ marker: MTMarker) async

    Parameters

    marker

    Marker to be added to the map.

  • 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?) async

    Parameters

    markers

    Markers to be added to the map.

    withSingleIcon

    Optional single image to use for all markers.

  • removeMarker(_:) Asynchronous

    Removes a marker from the map.

    Declaration

    Swift

    @MainActor
    public func removeMarker(_ marker: MTMarker) async

    Parameters

    marker

    Marker 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]) async

    Parameters

    markers

    Markers to be removed from the map.

  • addTextPopup(_:) Asynchronous

    Adds a text popup to the map.

    Declaration

    Swift

    @MainActor
    public func addTextPopup(_ popup: MTTextPopup) async

    Parameters

    popup

    Popup to be added to the map.

  • removeTextPopup(_:) Asynchronous

    Removes a text popup from the map.

    Declaration

    Swift

    @MainActor
    public func removeTextPopup(_ popup: MTTextPopup) async

    Parameters

    marker

    Popup to be removed from the map.

  • Enables the globe projection visualization.

    Declaration

    Swift

    @MainActor
    public func enableGlobeProjection() async
  • Enables the mercator projection visualization.

    Declaration

    Swift

    @MainActor
    public func enableMercatorProjection() async
  • Enables the 3D terrain visualization.

    Note

    Default is 1.

    Declaration

    Swift

    @MainActor
    public func enableTerrain(exaggerationFactor: Double = 1.0) async

    Parameters

    exaggerationFactor

    Factor for volume boosting.

  • disableTerrain() Asynchronous

    Disables the 3D terrain visualization.

    Declaration

    Swift

    @MainActor
    public func disableTerrain() async
  • 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) async

    Parameters

    degrees

    The vertical field of view to set, in degrees (0-180).

  • isSourceLoaded(id:) Asynchronous

    Returns boolean value indicating whether the source with provided id is loaded.

    Declaration

    Swift

    @MainActor
    public func isSourceLoaded(id: String) async -> Bool

    Parameters

    id

    The id of the source.

  • isMapLoaded() Asynchronous

    Returns boolean value indicating whether the map is fully loaded.

    Declaration

    Swift

    @MainActor
    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")
    @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

    completionHandler

    A 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

    completionHandler

    A 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

    zoom

    The zoom level to set (0-20).

    completionHandler

    A handler block to execute when function finishes.

  • zoomIn() Asynchronous

    Increases the map’s zoom level by 1.

    Declaration

    Swift

    @MainActor
    public func zoomIn() async
  • zoomOut() Asynchronous

    Decreases the map’s zoom level by 1.

    Declaration

    Swift

    @MainActor
    public func zoomOut() async
  • getZoom() Asynchronous

    Returns 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)