-
Undocumented
Declaration
Swift
public private(set) weak var styleManager: StyleManager! { get } -
Undocumented
Declaration
Swift
public init(with styleManager: StyleManager) -
URL of the style currently displayed in the receiver.
The URL may be a full HTTP or HTTPS URL ,a Mapbox style URL (mapbox://styles/{user}/{style}), or a URL for a style JSON file.
If you set this property to
nil, the receiver will use the default style and this property will automatically be set to that style’s URL.Declaration
Swift
public var styleURL: StyleURL { get set }
-
Adds a
layerto the mapDeclaration
Swift
@discardableResult public func addLayer<T>(layer: T, layerPosition: LayerPosition? = nil) -> Result<Bool, LayerError> where T : LayerParameters
layerThe layer to apply on the map
Return Value
If operation successful, returns a
trueas part of theResultsuccess case. Else, returns aLayerErrorin theResultfailure case. -
Gets a
layerfrom the mapDeclaration
Swift
public func getLayer<T>(with layerID: String, type: T.Type) -> Result<T, LayerError> where T : LayerParameters
layerIDThe id of the layer to be fetched
typeThe type of the layer that will be fetched
Return Value
The fully formed
layerobject of type equal totypeis returned as part of theResults success case if the operation is successful. Else, returns aLayerErroras part of theResultfailure case. -
Add a given
UIImageto the map style’s sprite, or updates the given image in the sprite if it already exists.You must call this method after the map’s style has finished loading in order to set any image or pattern properties on a style layer.
Declaration
Swift
@discardableResult public func setStyleImage(image: UIImage, with identifier: String, sdf: Bool = false, stretchX: [ImageStretches] = [], stretchY: [ImageStretches] = [], scale: CGFloat, imageContent: ImageContent? = nil) -> Result<Bool, ImageError>Parameters
imageThe image to be added to the map style’s sprite.
identifierThe name of the image the map style’s sprite will use for identification.
sdfWhether or not the image is treated as a signed distance field. Defaults to
false.stretchXThe array of horizontal image stretch areas. Defaults to an empty array.
stretchYThe array of vertical image stretch areas. Defaults to an empty array.
scaleThe scale factor for the image.
imageContentThe
ImageContentwhich describes where text can be fit into an image. By default, this isnil.Return Value
A boolean associated with a
Resulttype if the operation is successful. Otherwise, this will return aStyleErroras part of theResultfailure case. -
Undocumented
Declaration
Swift
public func getStyleImage(with identifier: String) -> Image? -
Remove a style layer from the map with specific id.
Declaration
Swift
public func removeStyleLayer(forLayerId: String) -> Result<Bool, LayerError>Return Value
A boolean associated with a
Resulttype if the operation is successful. Otherwise, this will return aLayerErroras part of theResultfailure case.
-
Adds a source to the map
Declaration
Swift
@discardableResult public func addSource<T>(source: T, identifier: String) -> Result<Bool, SourceError> where T : SourceParameters
sourceThe source to add to the map.
identifierA unique source identifier.
Return Value
If operation successful, returns a
trueas part of theResultsuccess case. Else, returns aSourceErrorin theResultfailure case. -
Retrieves a source from the map
Declaration
Swift
public func getSource<T>(identifier: String, type: T.Type) -> Result<T, SourceError> where T : SourceParameters
identifierThe id of the source to retrieve
typeThe type of the source
Return Value
The fully formed
sourceobject of type equal totypeis returned as part of theResults success case if the operation is successful. Else, returns aSourceErroras part of theResultfailure case. -
Set a source property for a given source to an updated value.
Declaration
Swift
@discardableResult public func updateSourceProperty(id: String, property: String, value: [String : Any]) -> Result<Bool, SourceError>Parameters
idThe identifier representing the source.
propertyThe name of the source property to change.
valueThe new value to for the
property.Return Value
If operation successful, returns a
trueas part of theResultsuccess case. Else, returns aSourceErrorin theResultfailure case. -
Updates the
dataproperty of a givenGeoJSONSourcewith a new value conforming to theGeoJSONObjectprotocol.Note
This method is only effective with sources ofGeoJSONSourcetype, and should not be used to update other source types.Declaration
Swift
public func updateGeoJSON<T>(for sourceIdentifier: String, with geoJSON: T) -> Result<Bool, SourceError> where T : GeoJSONObjectParameters
sourceIdentifierThe identifier representing the GeoJSON source.
geoJSONThe new GeoJSON to be associated with the source data.
Return Value
If operation successful, returns a
trueas part of theResultsuccess case. Else, returns anErrorin theResultfailure case. -
Sets a terrain on the style
Declaration
Swift
@discardableResult public func setTerrain(_ terrain: Terrain) -> Result<Bool, TerrainError>Parameters
terrainThe
Terrainthat should be renderedReturn Value
Result type with
.successif terrain is successfully applied.TerrainErrorotherwise. -
Remove a source with a specified identifier from the map.
Declaration
Swift
public func removeSource(for sourceID: String) -> Result<Bool, SourceError>Parameters
sourceIDThe unique identifer representing the source to be removed.
Return Value
If operation successful, returns a
trueas part of theResultsuccess case. Else, returns aSourceErrorin theResultfailure case. -
Add a light object to the map’s style
Declaration
Swift
public func addLight(_ light: Light) -> Result<Bool, LightError>Parameters
lightThe
Lightobject to be applied to the style.Return Value
IF operation successful, returns a
trueas part of theResult. Else returns aLightError. -
Updates a layer that exists in the style already
Declaration
Swift
@discardableResult public func updateLayer<T>(id: String, type: T.Type, update: (inout T) -> Void) -> Result<Bool, LayerError> where T : LayerParameters
ididentifier of layer to update
typeType of the layer
updateClosure that mutates a layer passed to it
Return Value
Result type with
.successif update is successful,LayerErrorotherwise
Style Class Reference