Style
public final class Style
This class provides a container for tiles sources information and map layers.
-
A collection of map’s tile sources.
This collection is a container of
TilesDefinitions, in which json meta-data and important information about the tiles sources is stored. For example, minZoom, maxZoom, type and tile endpoints.Declaration
Swift
public let sources: SourceCollection -
An
Arrayof the mapLayers included in a given style.Map layers are map elements, for example: Borders, Background, Traffic Incidents, Markers, Labels, etc. Each element of the array contains all the information needed to render a layer. Note that a single element of a map, such as a road, may consist of several layers. You can hide specific map layers to get the level of detail you need and highlight the layers that are important for your use case. For example, you can toggle the visibility of the background layer using
layersForRegexp(pattern:):let layers = try? map.layersForRegexp(pattern: NSRegularExpression(pattern: "background", options: [])) layers?.forEach { $0.isVisible = false } // The background layer won't show on the map. layers?.forEach { $0.isVisible = true } // The background layer shows on the map.Declaration
Swift
public var layers: [Layer] -
Fetches an
ArrayofLayers based on the given regex pattern.The regex is applied to the
Layer.idproperty.Example:
let roads = NSRegularExpression(pattern: ".*[rR]oad.*", options: [])) mapView.map.layersForRegexp(pattern: roads)
Declaration
Swift
public func layersForRegex(pattern: NSRegularExpression) -> [Layer]Parameters
patternRegex pattern.
Return Value
Instances of fetched
Layer.
TomTom SDK for iOS (0.53.1)
Style