MapView
extension MapView
An extension on MapView
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(_ tileSetIdentifier: String) -> Set<String>
-
Method, which returns identifiers of the tile sets that make up specific source.
This array contains multiple entries for a composited source. This property is empty for non-Mapbox-hosted tile sets and sources with type other than
vector
.Declaration
Swift
func tileSetIdentifiers(_ sourceIdentifier: String, sourceType: String) -> [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
isVisible
Parameter, which controls whether layer should be visible or not.
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 }
-
Returns a list of style source datasets (e.g.
mapbox.mapbox-streets-v8
), based on provided selected style source types.Declaration
Swift
func styleSourceDatasets(_ sourceTypes: [String]) -> [String]
Parameters
sourceTypes
List of
MapView
source types (e.g.vector
). -
Method, which returns list of source identifiers, which contain streets tile set.
Declaration
Swift
func streetsSources() -> [SourceInfo]