MGLMapView
extension MGLMapView
An extension on MGLMapView
that allows for toggling traffic on a map style that contains a Mapbox Traffic source.
-
Returns a set of source identifiers for tilesets that are or include the Mapbox Incidents source.
Declaration
Swift
func sourceIdentifiers(forTileSetIdentifier tileSetIdentifier: String) -> Set<String>
-
Returns a Boolean value indicating whether data from the given tile set layer is currently visible in the map view’s style.
Declaration
Swift
func showsTileSet(withIdentifier tileSetIdentifier: String, layerIdentifier: String) -> Bool
Parameters
tileSetIdentifier
Identifier of the tile set 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 layer.
Declaration
Swift
func setShowsTileSet(_ isVisible: Bool, withIdentifier tileSetIdentifier: String, layerIdentifier: String)
Parameters
tileSetIdentifier
Identifier of the tile set 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 }