MTNavigable

@MainActor
public protocol MTNavigable

Defines methods for navigating the map.

  • setBearing(_:) Asynchronous

    Sets bearing of the map.

    Declaration

    Swift

    @MainActor
    func setBearing(_ bearing: Double) async

    Parameters

    bearing

    The bearing of the map, measured in degrees counter-clockwise from north.

  • setCenter(_:) Asynchronous

    Sets the geographical center of the map.

    Declaration

    Swift

    @MainActor
    func setCenter(_ center: CLLocationCoordinate2D) async

    Parameters

    center

    Geographical center of the map.

  • Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that evokes flight.

    Declaration

    Swift

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

    Parameters

    center

    Geographical center of the map.

    options

    FlyTo options.

    animationOptions

    animation options.

  • Changes any combination of center, zoom, bearing and pitch with an animated transition between old and new values.

    Declaration

    Swift

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

    Parameters

    center

    Geographical center of the map.

    options

    Camera options.

    animationOptions

    animation options.

  • jumpTo(_:options:) Asynchronous

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

    Declaration

    Swift

    @MainActor
    func jumpTo(_ center: CLLocationCoordinate2D, options: MTCameraOptions?) async

    Parameters

    center

    Geographical center of the map.

    options

    Camera options.

  • fitBounds(_:options:) Asynchronous

    Fits the camera so that the provided bounds are fully visible within the viewport.

    Declaration

    Swift

    @MainActor
    func fitBounds(_ bounds: MTBounds, options: MTFitBoundsOptions?) async

    Parameters

    bounds

    Geographic bounds to display.

    options

    Additional fit configuration.

  • panBy(_:) Asynchronous

    Pans the map by the specified offset.

    Declaration

    Swift

    @MainActor
    func panBy(_ offset: MTPoint) async

    Parameters

    offset

    Offset to pan by.

  • panTo(_:) Asynchronous

    Pans the map to the specified location with an animated transition.

    Declaration

    Swift

    @MainActor
    func panTo(_ coordinates: CLLocationCoordinate2D) async

    Parameters

    coordinates

    Coordinates to pan to.

  • stop() Asynchronous

    Stops any ongoing animated transition.

    Declaration

    Swift

    @MainActor
    func stop() async
  • Snaps the map so that north is up.

    Declaration

    Swift

    @MainActor
    func snapToNorth(animationOptions: MTAnimationOptions?) async

    Parameters

    animationOptions

    Animation options.

  • setPadding(_:) Asynchronous

    Sets the padding in pixels around the viewport.

    Declaration

    Swift

    @MainActor
    func setPadding(_ options: MTPaddingOptions) async

    Parameters

    options

    Padding options.

  • fitToIpBounds() Asynchronous

    Fits the map to the country-level bounds inferred from the current IP address.

    Declaration

    Swift

    @MainActor
    func fitToIpBounds() async
  • Sets the center clamped to the ground.

    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.

    Declaration

    Swift

    @MainActor
    func setIsCenterClampedToGround(_ isCenterClampedToGround: Bool) async

    Parameters

    isCenterClampedToGround

    Boolean indicating whether center is clamped to the ground.

  • setCenterElevation(_:) Asynchronous

    Sets the elevation of the map’s center point, in meters above sea level.

    Declaration

    Swift

    @MainActor
    func setCenterElevation(_ elevation: Double) async

    Parameters

    elevation

    Desired elevation.

  • setMaxPitch(_:) Asynchronous

    Sets the map’s maximum pitch.

    Declaration

    Swift

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

    Parameters

    maxPitch

    Desired pitch.

  • setMaxZoom(_:) Asynchronous

    Sets the map’s maximum zoom.

    Declaration

    Swift

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

    Parameters

    maxZoom

    Desired zoom.

  • setMinPitch(_:) Asynchronous

    Sets the map’s minimum pitch.

    Declaration

    Swift

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

    Parameters

    minPitch

    Desired pitch.

  • setMinZoom(_:) Asynchronous

    Sets the map’s minimum zoom.

    Declaration

    Swift

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

    Parameters

    minZoom

    Desired zoom.

  • setMaxBounds(_:) Asynchronous

    Sets or clears the maximum bounds constraint applied to the map.

    Declaration

    Swift

    @MainActor
    func setMaxBounds(_ bounds: MTBounds?) async throws

    Parameters

    bounds

    Geographic bounds to restrict panning, or nil to remove the constraint.

  • setPitch(_:) Asynchronous

    Sets the map’s pitch.

    Declaration

    Swift

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

    Declaration

    Swift

    @MainActor
    func setRoll(_ roll: Double) async

    Parameters

    roll

    Desired roll.

  • getPitch() Asynchronous

    Returns the map’s current pitch.

    Declaration

    Swift

    @MainActor
    func getPitch() async -> Double
  • getMaxPitch() Asynchronous

    Returns the map’s maximum pitch.

    Declaration

    Swift

    @MainActor
    func getMaxPitch() async -> Double
  • getMaxZoom() Asynchronous

    Returns the map’s maximum zoom.

    Declaration

    Swift

    @MainActor
    func getMaxZoom() async -> Double
  • getMinPitch() Asynchronous

    Returns the map’s minimum pitch.

    Declaration

    Swift

    @MainActor
    func getMinPitch() async -> Double
  • getMinZoom() Asynchronous

    Returns the map’s minimum zoom.

    Declaration

    Swift

    @MainActor
    func getMinZoom() async -> Double
  • getCenter() Asynchronous

    Returns the map’s current center.

    Declaration

    Swift

    @MainActor
    func getCenter() async -> CLLocationCoordinate2D
  • getBounds() Asynchronous

    Returns the current viewport bounds.

    Declaration

    Swift

    @MainActor
    func getBounds() async -> MTBounds
  • getMaxBounds() Asynchronous

    Returns the maximum allowed bounds constraint if one is set.

    Declaration

    Swift

    @MainActor
    func getMaxBounds() async -> MTBounds?
  • Returns the state of the center clamped to ground flag.

    Declaration

    Swift

    @MainActor
    func getCenterClampedToGround() async -> Bool
  • getCenterElevation() Asynchronous

    Returns the elevation of the map’s center point in meters above sea level.

    Declaration

    Swift

    @MainActor
    func getCenterElevation() async -> Double
  • Returns the elevation for the point where the camera is looking, in meters above sea level multiplied by exaggeration.

    Declaration

    Swift

    @MainActor
    func getCameraTargetElevation() async -> Double
  • getBearing() Asynchronous

    Returns the map’s current bearing.

    Declaration

    Swift

    @MainActor
    func getBearing() async -> Double
  • getRoll() Asynchronous

    Returns the map’s current roll.

    Declaration

    Swift

    @MainActor
    func getRoll() async -> Double