MapView

extension MapView

An extension on MapView that allows for toggling traffic on a map style that contains a Mapbox Traffic source.

  • Returns a Boolean value indicating whether data from the given tile set layers is currently all visible in the map view’s style.

    Declaration

    Swift

    public func showsTileSet(with tileSetIdentifiers: Set<String>, layerIdentifier: String) -> Bool

    Parameters

    tileSetIdentifiers

    Identifiers of the tile sets in the form user.tileset.

    layerIdentifier

    Identifier of the layer in the tile set; in other words, a source layer identifier. Not to be confused with a style layer.

  • Shows or hides data from the given tile set layers.

    Declaration

    Swift

    public func setShowsTileSet(_ isVisible: Bool, with tileSetIdentifiers: Set<String>, layerIdentifier: String)

    Parameters

    isVisible

    Parameter, which controls whether layer should be visible or not.

    tileSetIdentifiers

    Identifiers of the tile sets in the form user.tileset.

    layerIdentifier

    Identifier of the layer in the tile set; in other words, a source layer identifier. Not to be confused with a style layer.

  • A Boolean value indicating whether traffic congestion lines are visible in the map view’s style.

    Declaration

    Swift

    public var showsTraffic: Bool { get set }
  • A Boolean value indicating whether incidents, such as road closures and detours, are visible in the map view’s style.

    Declaration

    Swift

    public var showsIncidents: Bool { get set }