-
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
layer
to the mapDeclaration
Swift
@discardableResult public func addLayer<T>(layer: T, layerPosition: LayerPosition? = nil) -> Result<Bool, LayerError> where T : Layer
Parameters
layer
The layer to apply on the map
Return Value
If operation successful, returns a
true
as part of theResult
success case. Else, returns aLayerError
in theResult
failure case. -
Gets a
layer
from the mapDeclaration
Swift
public func getLayer<T>(with layerID: String, type: T.Type) -> Result<T, LayerError> where T : Layer
Parameters
layerID
The id of the layer to be fetched
type
The type of the layer that will be fetched
Return Value
The fully formed
layer
object of type equal totype
is returned as part of theResult
s success case if the operation is successful. Else, returns aLayerError
as part of theResult
failure case. -
Add a given
UIImage
to 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
image
The image to be added to the map style’s sprite.
identifier
The name of the image the map style’s sprite will use for identification.
sdf
Whether or not the image is treated as a signed distance field. Defaults to
false
.stretchX
The array of horizontal image stretch areas. Defaults to an empty array.
stretchY
The array of vertical image stretch areas. Defaults to an empty array.
scale
The scale factor for the image.
imageContent
The
ImageContent
which describes where text can be fit into an image. By default, this isnil
.Return Value
A boolean associated with a
Result
type if the operation is successful. Otherwise, this will return aStyleError
as part of theResult
failure 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
Result
type if the operation is successful. Otherwise, this will return aLayerError
as part of theResult
failure case.
-
Adds a source to the map
Declaration
Swift
@discardableResult public func addSource<T>(source: T, identifier: String) -> Result<Bool, SourceError> where T : Source
Parameters
source
The source to add to the map.
identifier
A unique source identifier.
Return Value
If operation successful, returns a
true
as part of theResult
success case. Else, returns aSourceError
in theResult
failure case. -
Retrieves a source from the map
Declaration
Swift
public func getSource<T>(identifier: String, type: T.Type) -> Result<T, SourceError> where T : Source
Parameters
identifier
The id of the source to retrieve
type
The type of the source
Return Value
The fully formed
source
object of type equal totype
is returned as part of theResult
s success case if the operation is successful. Else, returns aSourceError
as part of theResult
failure 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
id
The identifier representing the source.
property
The name of the source property to change.
value
The new value to for the
property
.Return Value
If operation successful, returns a
true
as part of theResult
success case. Else, returns aSourceError
in theResult
failure case. -
Updates the
data
property of a givenGeoJSONSource
with a new value conforming to theGeoJSONObject
protocol.Note
This method is only effective with sources ofGeoJSONSource
type, 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 : GeoJSONObject
Parameters
sourceIdentifier
The identifier representing the GeoJSON source.
geoJSON
The new GeoJSON to be associated with the source data.
Return Value
If operation successful, returns a
true
as part of theResult
success case. Else, returns anError
in theResult
failure case. -
Sets a terrain on the style
Declaration
Swift
@discardableResult public func setTerrain(_ terrain: Terrain) -> Result<Bool, TerrainError>
Parameters
terrain
The
Terrain
that should be renderedReturn Value
Result type with
.success
if terrain is successfully applied.TerrainError
otherwise. -
Remove a source with a specified identifier from the map.
Declaration
Swift
public func removeSource(for sourceID: String) -> Result<Bool, SourceError>
Parameters
sourceID
The unique identifer representing the source to be removed.
Return Value
If operation successful, returns a
true
as part of theResult
success case. Else, returns aSourceError
in theResult
failure case. -
Add a light object to the map’s style
Declaration
Swift
public func addLight(_ light: Light) -> Result<Bool, LightError>
Parameters
light
The
Light
object to be applied to the style.Return Value
IF operation successful, returns a
true
as 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 : Layer
Parameters
id
identifier of layer to update
type
Type of the layer
update
Closure that mutates a layer passed to it
Return Value
Result type with
.success
if update is successful,LayerError
otherwise