MapTiler SDK Swift API Reference

Actors

The following actors are available globally.

  • Object representing the SDK global settings.

    Exposes properties and options such as API Key and caching preferences.

    See more

    Declaration

    Swift

    public actor MTConfig

Classes

The following classes are available globally.

  • Subclassable view for adding custom annotations to the map.

    See more

    Declaration

    Swift

    @MainActor
    open class MTCustomAnnotationView : UIView, @preconcurrency MTAnnotation
    extension MTCustomAnnotationView: @preconcurrency MTMapViewContent
  • Annotation element that can be added to the map.

    See more

    Declaration

    Swift

    public class MTMarker : MTAnnotation, MTMapViewContent, @unchecked Sendable
  • Basic text popup.

    Can be attached to MTMarker or standalone.

    See more

    Declaration

    Swift

    public class MTTextPopup : MTAnnotation, MTMapViewContent, @unchecked Sendable
  • Basic benchmarking class.

    See more

    Declaration

    Swift

    @MainActor
    public final class MTBenchmark : MTMapViewDelegate
  • 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.

    See more

    Declaration

    Swift

    @MainActor
    open class MTMapView : UIView, Sendable
    extension MTMapView: MTControllable
    extension MTMapView: MTNavigable
    extension MTMapView: MTRendering
    extension MTMapView: MTStylable
    extension MTMapView: MTZoomable
    extension MTMapView: MTLocationManagerDelegate
  • Helper for creating a heatmap visualization layer from data and styling options.

    See more

    Declaration

    Swift

    public final class MTHeatmapLayerHelper : MTVectorLayerHelper, @unchecked Sendable
  • Helper for creating a point visualization layer from data and styling options.

    Uses the current style to create the underlying source and layers.

    See more

    Declaration

    Swift

    public final class MTPointLayerHelper : MTVectorLayerHelper, @unchecked Sendable
  • Helper for creating a polygon (fill) visualization layer from data and styling options.

    See more

    Declaration

    Swift

    public final class MTPolygonLayerHelper : MTVectorLayerHelper, @unchecked Sendable
  • Helper for creating a polyline (line) visualization layer from data and styling options.

    See more

    Declaration

    Swift

    public final class MTPolylineLayerHelper : MTVectorLayerHelper, @unchecked Sendable
  • Logger class used for SDK logs.

    See more

    Declaration

    Swift

    public class MTLogger
  • Class responsible for location updates.

    See more

    Declaration

    Swift

    public class MTLocationManager : NSObject, @preconcurrency CLLocationManagerDelegate
  • Service responsible for gesture handling and state.

    See more

    Declaration

    Swift

    @MainActor
    public class MTGestureService
  • Sets combination of center, bearing and pitch, as well as roll and elevation.

    See more

    Declaration

    Swift

    public class MTMapCameraHelper
  • The proxy object for the current map style.

    Set of convenience methods for style, sources and layers manipulation. MTStyle is nil until map loading is complete. Since it is loaded asynchronously it should be manipulated only after MTEvent.didLoad triggers.

    See more

    Declaration

    Swift

    @MainActor
    public class MTStyle
  • The background style layer covers the entire map. Use a background style layer to configure a color or pattern to show below all other map content. If the background layer is transparent or omitted from the style, any part of the map view that does not show another style layer is transparent.

    See more

    Declaration

    Swift

    public class MTBackgroundLayer : MTLayer, @unchecked Sendable, Codable
  • The circle style layer renders one or more filled circles on the map.

    See more

    Declaration

    Swift

    public class MTCircleLayer : MTLayer, @unchecked Sendable, Codable
    extension MTCircleLayer: Equatable
  • The fill style layer that renders one or more filled (and optionally stroked) polygons on a map.

    See more

    Declaration

    Swift

    public class MTFillLayer : MTLayer, @unchecked Sendable, Codable
    extension MTFillLayer: Equatable
  • A fill-extrusion style layer renders one or more filled (and optionally stroked) extruded (3D) polygons on a map.

    See more

    Declaration

    Swift

    public class MTFillExtrusionLayer : MTLayer, @unchecked Sendable, Codable
    extension MTFillExtrusionLayer: Equatable
  • A heatmap style layer renders a range of colors to represent the density of points in an area.

    See more

    Declaration

    Swift

    public class MTHeatmapLayer : MTLayer, @unchecked Sendable, Codable
    extension MTHeatmapLayer: Equatable
  • A hillshade style layer renders digital elevation model (DEM) data on the client-side. Supports Terrain RGB and Mapzen Terrarium tiles via a raster-dem source.

    See more

    Declaration

    Swift

    public class MTHillshadeLayer : MTLayer, @unchecked Sendable, Codable
  • The line style layer that renders one or more stroked polylines on the map.

    See more

    Declaration

    Swift

    public class MTLineLayer : MTLayer, @unchecked Sendable, Codable
  • The raster style layer renders raster map textures such as imagery.

    See more

    Declaration

    Swift

    public class MTRasterLayer : MTLayer, @unchecked Sendable, Codable
  • The symbol style that layer renders icon and text labels at points or along lines on a map.

    See more

    Declaration

    Swift

    public class MTSymbolLayer : MTLayer, @unchecked Sendable, Codable
    extension MTSymbolLayer: Equatable
  • A geojson source.

    See more

    Declaration

    Swift

    public class MTGeoJSONSource : MTSource, @unchecked Sendable, Codable
  • An image source.

    The url value contains the image location. The coordinates array contains [longitude, latitude] pairs for the image corners listed in clockwise order: top left, top right, bottom right, bottom left.

    See more

    Declaration

    Swift

    public class MTImageSource : MTSource, @unchecked Sendable
  • A raster DEM source. Only supports Terrain RGB.

    See more

    Declaration

    Swift

    public class MTRasterDEMSource : MTTileSource, @unchecked Sendable
  • A raster tile source.

    For raster tiles hosted by MapTiler, the “url” value should be of the form https://api.maptiler.com/tiles/[tilesetid]/tiles.json?key=

    See more

    Declaration

    Swift

    public class MTRasterTileSource : MTTileSource, @unchecked Sendable
  • Undocumented

    See more

    Declaration

    Swift

    public class MTVectorTileSource : MTTileSource, @unchecked Sendable
  • A video source.

    The urls value is an array. For each URL in the array, a video element source will be created. The coordinates array contains [longitude, latitude] pairs for the video corners listed in clockwise order: top left, top right, bottom right, bottom left.

    See more

    Declaration

    Swift

    public class MTVideoSource : MTSource, @unchecked Sendable
  • Swift wrapper over the MapTiler SDK ColorRamp class.

    See more

    Declaration

    Swift

    @MainActor
    public final class MTColorRamp : @unchecked Sendable

Enumerations

The following enumerations are available globally.

  • Anchor positions for marker placement.

    See more

    Declaration

    Swift

    public enum MTAnchor : String, Sendable, Codable
  • Alignment for marker rotation relative to map or viewport.

    See more

    Declaration

    Swift

    public enum MTMarkerRotationAlignment : String, Sendable, Codable
  • Alignment for marker pitch relative to map or viewport.

    See more

    Declaration

    Swift

    public enum MTMarkerPitchAlignment : String, Sendable, Codable
  • Represents all the errors that can occur in the MapTiler SDK.

    All methods within the SDK throw MTError.

    See more

    Declaration

    Swift

    public enum MTError : Error
  • SDK log level.

    See more

    Declaration

    Swift

    public enum MTLogLevel : Sendable, Equatable
  • Type of log messages in the SDK.

    See more

    Declaration

    Swift

    public enum MTLogType : Sendable
  • Events triggered by the SDK

    See more

    Declaration

    Swift

    public enum MTEvent : String
  • Language of the map labels.

    See more

    Declaration

    Swift

    public enum MTLanguage : Sendable, Codable
  • Custom language options.

    See more

    Declaration

    Swift

    public enum MTSpecialLanguage : String, Sendable, Codable
  • Languages available for MTMapView object.

    See more

    Declaration

    Swift

    public enum MTCountryLanguage : String, Sendable, Codable, CaseIterable
  • Enum representing MTLocationManager errors.

    See more

    Declaration

    Swift

    public enum MTLocationError : Error
  • Units of measurement used in MTMapView object.

    See more

    Declaration

    Swift

    public enum MTUnit : String, Sendable
  • Gesture types available in the SDK.

    See more

    Declaration

    Swift

    @MainActor
    public enum MTGestureType
  • Controls which map events are forwarded from the map object.

    • essential: Low-frequency lifecycle events only (ready, load, moveend, etc.) plus taps.
    • cameraOnly: Forwards only camera events (move, zoom) in addition to minimal lifecycle.
    • all: Default. Forwards all events including high-frequency move/zoom/touch/render (use with caution on low-end devices).
    • off: Minimal wiring to keep internal lifecycle (ready/load) functioning; all other events are suppressed.
    See more

    Declaration

    Swift

    public enum MTEventLevel : String, Codable, Sendable
  • Performance-oriented presets for MapTiler Swift SDK.

    See more

    Declaration

    Swift

    public enum MTPerformancePresets
  • Padding values accepted by MTFitBoundsOptions.

    See more

    Declaration

    Swift

    public enum MTFitBoundsPadding : Sendable, Codable, Equatable
  • Helper to construct common style expressions without raw strings.

    See more

    Declaration

    Swift

    public enum MTExpression
  • Commonly-used feature keys

    See more

    Declaration

    Swift

    public enum MTFeatureKey : String, Sendable
  • Helper to construct common filter expressions without raw strings.

    See more

    Declaration

    Swift

    public enum MTFilter
  • Typed keys for circle paint properties.

    See more

    Declaration

    Swift

    public enum MTCirclePaintProperty : String, Sendable
  • Typed keys for symbol layout properties.

    See more

    Declaration

    Swift

    public enum MTSymbolLayoutProperty : String, Sendable
  • Typed keys for symbol paint properties.

    See more

    Declaration

    Swift

    public enum MTSymbolPaintProperty : String, Sendable
  • Orientation of the circle when map is pitched.

    See more

    Declaration

    Swift

    public enum MTCirclePitchAlignment : String
  • Controls the scaling behavior of the circle when the map is pitched.

    See more

    Declaration

    Swift

    public enum MTCirclePitchScale : String
  • Controls the frame of reference for circle translate.

    See more

    Declaration

    Swift

    public enum MTCircleTranslateAnchor : String
  • Enum controlling the frame of reference for fill translate.

    See more

    Declaration

    Swift

    public enum MTFillTranslateAnchor : String
  • Controls the frame of reference for fill-extrusion translate.

    See more

    Declaration

    Swift

    public enum MTFillExtrusionTranslateAnchor : String
  • Direction of light source when map is rotated.

    See more

    Declaration

    Swift

    public enum MTHillshadeIlluminationAnchor : String
  • The display of line endings.

    See more

    Declaration

    Swift

    public enum MTLineCap : String
  • The display of lines when joining.

    See more

    Declaration

    Swift

    public enum MTLineJoin : String
  • Controls the frame of reference for line translate.

    See more

    Declaration

    Swift

    public enum MTLineTranslateAnchor : String
  • Types of layers.

    See more

    Declaration

    Swift

    public enum MTLayerType : String, Codable
  • Enum representing the visibility of the layer.

    See more

    Declaration

    Swift

    public enum MTLayerVisibility : String
  • Resampling/interpolation method to use for overscaling.

    See more

    Declaration

    Swift

    public enum MTRasterResampling : String, Codable, Sendable
  • Defines purpose and guidelines on what information is displayed.

    See more

    Declaration

    Swift

    public enum MTMapReferenceStyle : Identifiable, Hashable, Sendable
  • Variants of the reference styles.

    See more

    Declaration

    Swift

    public enum MTMapStyleVariant : String, Sendable, CaseIterable, Identifiable
  • A typed value container

    See more

    Declaration

    Swift

    public enum MTPropertyValue : Sendable
  • Represents the exceptions raised by the MTStyle object.

    See more

    Declaration

    Swift

    public enum MTStyleError : Error
  • A unified style value that may be a constant or an expression.

    See more

    Declaration

    Swift

    public enum MTStyleValue : Sendable
  • A scheme used for tiles.

    See more

    Declaration

    Swift

    public enum MTTileScheme : String
  • Encoding used by the Raster DEM source.

    See more

    Declaration

    Swift

    public enum MTRasterDEMEncoding : String, Sendable
  • Types of sources.

    Sources state which data the map should display.

    See more

    Declaration

    Swift

    public enum MTSourceType : String, Codable
  • Symbol text anchor positions.

    See more

    Declaration

    Swift

    public enum MTTextAnchor : String, Sendable
  • Common text field tokens

    See more

    Declaration

    Swift

    public enum MTTextToken : String, Sendable
  • Representing the control of the change rate of the animation.

    See more

    Declaration

    Swift

    public enum MTEasing : String, Sendable, Codable
  • Option that can enable default halo or configure it.

    See more

    Declaration

    Swift

    public enum MTHaloOption : Sendable, Codable
  • Sets whether extruded geometries are lit relative to the map or viewport.

    See more

    Declaration

    Swift

    public enum MTLightAnchor : String, Sendable, Codable
  • Represents corners of the map.

    See more

    Declaration

    Swift

    public enum MTMapCorner : String, Sendable, Codable
  • Type of projection the map uses.

    See more

    Declaration

    Swift

    public enum MTProjectionType : String, Sendable, Codable
  • Predefined cubemap presets for space backgrounds.

    See more

    Declaration

    Swift

    public enum MTSpacePreset : String, Sendable, Codable, CaseIterable
  • Option that can enable default space or configure it.

    See more

    Declaration

    Swift

    public enum MTSpaceOption : Sendable, Codable
  • Resampling methods supported by MapTiler SDK.

    See more

    Declaration

    Swift

    public enum MTColorRampResampleMethod : String, Sendable, Codable, CaseIterable
  • Built-in presets shipped with the SDK.

    See more

    Declaration

    Swift

    public enum MTColorRampPreset : String, Sendable, Codable, CaseIterable

Union helper types for encoding mixed-value options

  • Either a numeric value or zoom-ramped numeric values.

    See more

    Declaration

    Swift

    public enum MTNumberOrZoomNumberValues : Codable, Sendable
  • Either a string value or zoom-ramped string values.

    See more

    Declaration

    Swift

    public enum MTStringOrZoomStringValues : Codable, Sendable
  • Either a numeric value or property-mapped numeric values.

    See more

    Declaration

    Swift

    public enum MTNumberOrPropertyValues : Codable, Sendable
  • Heatmap radius can be a number, zoom-ramped numbers, or property-mapped numbers.

    See more

    Declaration

    Swift

    public enum MTRadiusOption : Codable, Sendable

Line-specific helper values

  • Represents a dash pattern that can be provided as an array of numbers or as a string pattern composed of underscores and spaces (e.g. “___ _ ”).

    See more

    Declaration

    Swift

    public enum MTDashArrayValue : Codable, Sendable
  • Expression element used to build MapTiler style expressions for sky values.

    See more

    Declaration

    Swift

    public enum MTSkyExpression : Sendable, Codable, Equatable
  • Represents a color or expression for the sky configuration.

    See more

    Declaration

    Swift

    public enum MTSkyColorValue : Sendable, Codable, Equatable
  • Represents a numeric value or expression for the sky configuration.

    See more

    Declaration

    Swift

    public enum MTSkyNumberValue : Sendable, Codable, Equatable

Extensions

The following extensions are available globally.

Protocols

The following protocols are available globally.

  • Protocol requirements for all annotation objects.

    See more

    Declaration

    Swift

    public protocol MTAnnotation : Sendable
  • Base protocol adopted by vector layer helpers to share defaults and common option normalization logic.

    See more

    Declaration

    Swift

    public protocol MTVectorLayerHelper : AnyObject
  • Protocol requirement for all Logger objects.

    See more

    Declaration

    Swift

    public protocol MTLoggable : Sendable
  • Protocol requirements for location manager.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTLocationManagerDelegate : AnyObject
  • Defines methods for adding the map controls.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTControllable
  • Defines methods for navigating the map.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTNavigable
  • Defines methods for adjusting rendering parameters.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTRendering
  • Defines methods for map styling methods.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTStylable
  • Defines methods for manipulating zoom level.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTZoomable
  • Defines gestures behaviour.

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTGesture
  • Map view content requirements.

    See more

    Declaration

    Swift

    public protocol MTMapViewContent
  • Delegate responsible for map event propagation

    See more

    Declaration

    Swift

    @MainActor
    public protocol MTMapViewDelegate : AnyObject
  • Protocol requirements for all types of Layers.

    See more

    Declaration

    Swift

    public protocol MTLayer : AnyObject, MTMapViewContent, Sendable
  • Protocol requirements for all types of Sources.

    See more

    Declaration

    Swift

    public protocol MTSource : AnyObject, MTMapViewContent, Sendable
  • Protocol requirements for all tile type sources.

    See more

    Declaration

    Swift

    public protocol MTTileSource : MTSource

Structures

The following structures are available globally.

  • Represents body of the MTError exception.

    See more

    Declaration

    Swift

    public struct MTException : Sendable
  • Color wrapper.

    See more

    Declaration

    Swift

    public struct MTColor : Sendable, Codable, Equatable
  • Options for building a heatmap visualization layer through the helper.

    See more

    Declaration

    Swift

    public struct MTHeatmapLayerOptions : Codable, Sendable
  • Options for building a point visualization layer through the helper.

    Mirrors the available configuration including common shape options.

    See more

    Declaration

    Swift

    public struct MTPointLayerOptions : Codable, Sendable
  • Options for building a polygon (fill) visualization layer through the helper.

    See more

    Declaration

    Swift

    public struct MTPolygonLayerOptions : Codable, Sendable
  • Options for building a polyline (line) visualization layer through the helper.

    See more

    Declaration

    Swift

    public struct MTPolylineLayerOptions : Codable, Sendable
  • Log object used with MTLogger.

    See more

    Declaration

    Swift

    public struct MTLog
  • Handles zooming in the map with double tap.

    See more

    Declaration

    Swift

    @MainActor
    public struct MTDoubleTapZoomInGesture : MTGesture
  • Handles panning the map by dragging.

    See more

    Declaration

    Swift

    @MainActor
    public struct MTDragPanGesture : MTGesture
  • Handles zoom and rotate by pinching with two fingers.

    See more

    Declaration

    Swift

    @MainActor
    public struct MTPinchRotateAndZoomGesture : MTGesture
  • Handles changing the pitch by dragging with two fingers.

    See more

    Declaration

    Swift

    @MainActor
    public struct MTTwoFingersDragPitchGesture : MTGesture
  • Map view content builder.

    See more

    Declaration

    Swift

    @resultBuilder
    public struct MTMapContentBuilder
  • Parameters of the map object.

    See more

    Declaration

    Swift

    public struct MTMapOptions : Sendable
    extension MTMapOptions: Codable
  • Declarative Map view for use in SwiftUI

    See more

    Declaration

    Swift

    @MainActor
    public struct MTMapViewContainer : View
  • Provides animation options for navigation functions.

    See more

    Declaration

    Swift

    public struct MTAnimationOptions : Sendable, Codable
  • Options for controlling the desired location, zoom, bearing, and pitch of the camera.

    See more

    Declaration

    Swift

    public struct MTCameraOptions : Sendable
    extension MTCameraOptions: Codable
  • Options for drag and pan gesstures.

    See more

    Declaration

    Swift

    public struct MTDragPanOptions : Sendable, Codable
  • Options that configure how the map fits to a set of bounds.

    See more

    Declaration

    Swift

    public struct MTFitBoundsOptions : Sendable, Codable
  • Options describing the destination and animation of the flyTo transition.

    See more

    Declaration

    Swift

    public struct MTFlyToOptions : Sendable, Codable
  • Options for setting padding on calls to map methods.

    See more

    Declaration

    Swift

    public struct MTPaddingOptions : Sendable, Codable, Equatable
  • Supporting type to add validation to another style related type.

    See more

    Declaration

    Swift

    public struct MTStyleSetterOptions : Sendable, Codable
  • Configuration that controls how an image is registered within the MapTiler style.

    See more

    Declaration

    Swift

    public struct MTStyleImageOptions : Codable, Equatable, Sendable
  • Represents rectangular geographic bounds defined by southwest and northeast corners.

    See more

    Declaration

    Swift

    public struct MTBounds : Sendable, Codable, Equatable
  • Object sent together with MTEvent.

    See more

    Declaration

    Swift

    public struct MTData : Codable
  • One stop in the halo radial gradient: position in [0,1] and color.

    See more

    Declaration

    Swift

    public struct MTHaloStop : Sendable, Codable
  • Configuration for the atmospheric glow (halo).

    See more

    Declaration

    Swift

    public struct MTHalo : Sendable, Codable
  • A style’s light property provides a global light source for that style.

    See more

    Declaration

    Swift

    public struct MTLight : Sendable, Codable
  • Two numbers representing x and y screen coordinates in pixels.

    See more

    Declaration

    Swift

    public struct MTPoint : Codable, Sendable
  • The style spec representation of the source if the event has a dataType of source .

    See more

    Declaration

    Swift

    public struct MTSourceData : Codable
  • Faces definition for a custom cubemap.

    See more

    Declaration

    Swift

    public struct MTSpaceFaces : Sendable, Codable
  • Path-based configuration for cubemap files.

    This fetches all images from a path, this assumes all files are named px, nx, py, ny, pz, nz and suffixed with the appropriate extension specified in format.

    See more

    Declaration

    Swift

    public struct MTSpacePath : Sendable, Codable
  • Configuration for the “space” background.

    See more

    Declaration

    Swift

    public struct MTSpace : Sendable, Codable
  • RGBA color represented by 0…255 components.

    See more

    Declaration

    Swift

    public struct MTRGBAColor : Sendable, Codable
  • A stop describing the value and color to apply.

    See more

    Declaration

    Swift

    public struct MTColorRampStop : Sendable, Codable
  • Bounds of a color ramp.

    See more

    Declaration

    Swift

    public struct MTColorRampBounds : Sendable, Codable
  • Options used when instantiating a color ramp.

    See more

    Declaration

    Swift

    public struct MTColorRampOptions : Sendable, Codable
  • Options for rendering the ramp to a canvas strip.

    See more

    Declaration

    Swift

    public struct MTColorRampCanvasStripOptions : Sendable, Codable
  • Array-based stop definition for fromArrayDefinition.

    See more

    Declaration

    Swift

    public struct MTColorRampArrayStop : Sendable, Codable
  • A single string value at a given zoom level.

    See more

    Declaration

    Swift

    public struct MTZoomStringValue : Codable, Sendable
  • A single numeric value at a given zoom level.

    See more

    Declaration

    Swift

    public struct MTZoomNumberValue : Codable, Sendable
  • A single mapping from a property value to an associated numeric value.

    See more

    Declaration

    Swift

    public struct MTHelperPropertyValue : Codable, Sendable

Colors

  • Encodes a color to a hex string when converted to JSON. Accepts either a hex color string (e.g. “#RRGGBB”) or a UIColor.

    See more

    Declaration

    Swift

    public struct MTColorValue : Codable, Sendable
  • Sky configuration used by map.setSky.

    See more

    Declaration

    Swift

    public struct MTSky : Sendable, Codable, Equatable