StyleManagerProtocol

public protocol StyleManagerProtocol

Undocumented

  • true if and only if the style JSON contents, the style specified sprite and sources are all loaded, otherwise returns false.

    Declaration

    Swift

    var isLoaded: Bool { get }
  • uri

    Get or set the style URI

    Setting a new style is asynchronous. In order to get the result of this operation, listen to MapEvents.styleDataLoaded, MapEvents.styleLoaded.

    Attention

    This method should be called on the same thread where the MapboxMap object is initialized.

    Declaration

    Swift

    var uri: StyleURI { get set }
  • Get or set the style via a JSON serialization string

    Attention

    This method should be called on the same thread where the MapboxMap object is initialized.

    Declaration

    Swift

    var JSON: String { get set }
  • The map style’s default camera, if any, or a default camera otherwise. The map style default camera is defined as follows:

    The style default camera is re-evaluated when a new style is loaded.

    Declaration

    Swift

    var defaultCamera: CameraOptions { get }
  • Get or set the map style’s transition options.

    By default, the style parser will attempt to read the style default transition options, if any, falling back to an immediate transition otherwise.

    The style transition is re-evaluated when a new style is loaded.

    Attention

    Overridden transition options are reset once a new style has been loaded.

    Declaration

    Swift

    var transition: TransitionOptions { get set }
  • Adds a new style layer given its JSON properties

    Runtime style layers are valid until they are either removed or a new style is loaded.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func addLayer(with properties: [String : Any], layerPosition: LayerPosition?) throws

    Parameters

    properties

    A JSON dictionary of style layer properties.

    layerPosition

    If not empty, the new layer will be positioned according to LayerPosition parameters.

  • Adds a new style custom layer.

    Runtime style layers are valid until they are either removed or a new style is loaded.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func addCustomLayer(withId id: String, layerHost: CustomLayerHost, layerPosition: LayerPosition?) throws

    Parameters

    id

    Style layer id.

    layerHost

    Style custom layer host.

    layerPosition

    If not empty, the new layer will be positioned according to LayerPosition parameters.

  • Removes an existing style layer

    Runtime style layers are valid until they are either removed or a new style is loaded.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func removeLayer(withId id: String) throws

    Parameters

    id

    Identifier of the style layer to remove.

  • Checks whether a given style layer exists.

    Runtime style layers are valid until they are either removed or a new style is loaded.

    Declaration

    Swift

    func layerExists(withId id: String) -> Bool

    Parameters

    id

    Style layer identifier.

    Return Value

    true if the given style layer exists, false otherwise.

  • The ordered list of the current style layers’ identifiers and types

    Declaration

    Swift

    var allLayerIdentifiers: [LayerInfo] { get }
  • Sets a JSON value to a style layer property.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setLayerProperty(for layerId: String, property: String, value: Any) throws

    Parameters

    layerId

    Style layer identifier.

    property

    Style layer property name.

    value

    Style layer property value.

  • Gets the properties for a style layer.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func layerProperties(for layerId: String) throws -> [String : Any]

    Parameters

    layerId

    layer id.

    Return Value

    JSON dictionary representing the layer properties

  • Sets style layer properties.

    This method can be used to perform batch update for a style layer properties. The structure of a provided properties value must conform to the format for a corresponding layer type.

    Modification of a layer identifier and/or layer type is not allowed.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setLayerProperties(for layerId: String, properties: [String : Any]) throws

    Parameters

    layerId

    Style layer identifier.

    properties

    JSON dictionary representing the updated layer properties.

  • Adds a new style source.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func addSource(withId sourceId: String, properties: [String : Any]) throws

    Parameters

    sourceId

    An identifier for the style source.

    properties

    A JSON dictionary of style source properties.

  • Removes an existing style source.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func removeSource(withId sourceId: String) throws

    Parameters

    sourceId

    Identifier of the style source to remove.

  • Checks whether a given style source exists.

    Declaration

    Swift

    func sourceExists(withId sourceId: String) -> Bool

    Parameters

    sourceId

    Style source identifier.

    Return Value

    true if the given source exists, false otherwise.

  • The ordered list of the current style sources’ identifiers and types

    Declaration

    Swift

    var allSourceIdentifiers: [SourceInfo] { get }
  • Sets a value to a style source property.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setSourceProperty(for sourceId: String, property: String, value: Any) throws

    Parameters

    sourceId

    Style source identifier.

    property

    Style source property name.

    value

    Style source property value (JSON value)

  • Gets style source properties.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func sourceProperties(for sourceId: String) throws -> [String : Any]

    Parameters

    sourceId

    Style source identifier

    Return Value

    JSON dictionary representing the layer properties

  • Sets style source properties.

    This method can be used to perform batch update for a style source properties. The structure of a provided properties value must conform to the format for a corresponding source type. Modification of a source type is not allowed.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setSourceProperties(for sourceId: String, properties: [String : Any]) throws

    Parameters

    sourceId

    Style source identifier

    properties

    A JSON dictionary of Style source properties

  • Adds an image to be used in the style.

    This API can also be used for updating an image. If the image id was already added, it gets replaced by the new image.

    The image can be used in icon-image, fill-pattern, and line-pattern.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func addImage(_ image: UIImage, id: String, sdf: Bool, stretchX: [ImageStretches], stretchY: [ImageStretches], content: ImageContent?) throws

    Parameters

    image

    Image to add.

    id

    ID of the image.

    sdf

    Option to treat whether image is SDF(signed distance field) or not.

    stretchX

    An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched horizontally.

    stretchY

    An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched vertically.

    content

    An array of four numbers, with the first two specifying the left, top corner, and the last two specifying the right, bottom corner. If present, and if the icon uses icon-text-fit, the symbol’s text will be fit inside the content box.

  • Removes an image from the style.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func removeImage(withId id: String) throws

    Parameters

    id

    ID of the image to remove.

  • Get an image from the style.

    Declaration

    Swift

    func image(withId id: String) -> UIImage?

    Parameters

    id

    ID of the image.

    Return Value

    UIImage representing the data associated with the given ID, or nil if no image is associated with that ID.

  • Sets the style global light source properties.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setLight(properties: [String : Any]) throws

    Parameters

    properties

    A dictionary of style light properties values, with their names as key.

  • Sets a value to the style light property.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setLightProperty(_ property: String, value: Any) throws

    Parameters

    property

    Style light property name.

    value

    Style light property value.

  • Sets the style global terrain source properties.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setTerrain(properties: [String : Any]) throws

    Parameters

    properties

    A dictionary of style terrain properties values, with their names as key.

  • Gets the value of a style terrain property.

    Declaration

    Swift

    func _terrainProperty(_ property: String) -> StylePropertyValue

    Parameters

    property

    Style terrain property name.

    Return Value

    Style terrain property value.

  • Sets a value to the named style terrain property.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func setTerrainProperty(_ property: String, value: Any) throws

    Parameters

    property

    Style terrain property name.

    value

    Style terrain property value.

  • Adds a custom geometry to be used in the style.

    To add the data, implement the fetchTileFunction callback in the options and call setCustomGeometrySourceTileData.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func addCustomGeometrySource(withId sourceId: String, options: CustomGeometrySourceOptions) throws

    Parameters

    sourceId

    Style source identifier

    options

    Settings for the custom geometry

  • Invalidate tile for provided custom geometry source.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func invalidateCustomGeometrySourceTile(forSourceId sourceId: String, tileId: CanonicalTileID) throws

    Parameters

    sourceId

    Style source identifier

    tileId

    Identifier of the tile

  • Invalidate region for provided custom geometry source.

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    func invalidateCustomGeometrySourceRegion(forSourceId sourceId: String, bounds: CoordinateBounds) throws

    Parameters

    sourceId

    Style source identifier

    bounds

    Coordinate bounds.