MTVectorTileSource

public class MTVectorTileSource : MTTileSource, @unchecked Sendable

Undocumented

  • Unique identifier of a source.

    Declaration

    Swift

    public var identifier: String
  • An array containing the longitude and latitude of the southwest and northeast corners of the source’s bounding box in the following order: [sw.lng, sw.lat, ne.lng, ne.lat].

    Note

    Defaults to [-180, -85.051129, 180, 85.051129].

    Declaration

    Swift

    public var bounds: [Double]
  • Maximum zoom level for which tiles are available.

    Note

    Defaults to 22.

    Declaration

    Swift

    public var maxZoom: Double
  • Minimum zoom level for which tiles are available.

    Note

    Defaults to 0.

    Declaration

    Swift

    public var minZoom: Double
  • Scheme used for tiles.

    Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed.

    Declaration

    Swift

    public var scheme: MTTileScheme
  • An array of one or more tile source URLs.

    Declaration

    Swift

    public var tiles: [URL]?
  • url

    A URL to a TileJSON resource. Supported protocols are http, https.

    Declaration

    Swift

    public var url: URL?
  • Attribution to be displayed when the map is shown to a user.

    Declaration

    Swift

    public var attribution: String?
  • Type of the layer.

    Declaration

    Swift

    public private(set) var type: MTSourceType { get }
  • Initializes the source with unique id and url to TileJSON resource.

    Declaration

    Swift

    public init(identifier: String, url: URL)
  • Initializes the source with unique id and one or more tile source urls.

    Declaration

    Swift

    public init(identifier: String, tiles: [URL])
  • Initializes the source with all options.

    Declaration

    Swift

    public init(
        identifier: String,
        bounds: [Double],
        maxZoom: Double,
        minZoom: Double,
        scheme: MTTileScheme,
        tiles: [URL]? = nil,
        url: URL? = nil,
        attribution: String? = nil
    )
  • Sets the url of the source.

    Used for updating the source data.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func setURL(url: URL, in mapView: MTMapView, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)

    Parameters

    url

    url to Vector Tile resource.

    mapView

    MTMapView which holds the source.

    completionHandler

    A handler block to execute when function finishes.

  • Sets the tiles of the source.

    Used for updating the source data.

    Declaration

    Swift

    @MainActor
    public func setTiles(
        tiles: [URL],
        in mapView: MTMapView,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    tiles

    list of urls with tile resources.

    mapView

    MTMapView which holds the source.

    completionHandler

    A handler block to execute when function finishes.

  • setURL(url:in:) Asynchronous

    Sets the url of the source.

    Used for updating the source data.

    Declaration

    Swift

    @MainActor
    public func setURL(url: URL, in mapView: MTMapView) async

    Parameters

    url

    url to Vector Tile resource.

    mapView

    MTMapView which holds the source.

  • setTiles(tiles:in:) Asynchronous

    Sets the tiles of the source.

    Used for updating the source data.

    Declaration

    Swift

    @MainActor
    public func setTiles(tiles: [URL], in mapView: MTMapView) async

    Parameters

    tiles

    list of urls with tile resources.

    mapView

    MTMapView which holds the source.

  • Adds source to map DSL style.

    Prefer addSource(_:) on MTMapView instead.

    Declaration

    Swift

    public func addToMap(_ mapView: MTMapView)