Style

public class Style

Undocumented

  • Undocumented

    Declaration

    Swift

    public private(set) weak var styleManager: StyleManager! { get }
  • Adds a layer to the map

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func addLayer(_ layer: Layer, layerPosition: LayerPosition? = nil) throws

    Parameters

    layer

    The layer to apply on the map

    layerPosition

    Position at which to add the map.

  • Gets a layer from the map

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func layer<T>(withId id: String) throws -> T 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 to type

  • Gets a layer from the map.

    This function is useful if you do not know the concrete type of the layer you are fetching, or don’t need to know for your situation.

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func _layer(withId id: String, type: Layer.Type) throws -> 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 to type

  • Updates a layer that exists in the style already

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func updateLayer<T>(withId id: String, update: (inout T) throws -> Void) throws where T : Layer

    Parameters

    id

    identifier of layer to update

    type

    Type of the layer

    update

    Closure that mutates a layer passed to it

  • Gets the value of style layer property.

    Declaration

    Swift

    public func layerProperty(for layerId: String, property: String) -> Any

    Parameters

    layerId

    Style layer identifier.

    property

    Style layer property name.

    Return Value

    The value of the property in the layer with layerId.

  • Adds a source to the map

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func addSource(_ source: Source, id: String) throws

    Parameters

    source

    The source to add to the map.

    identifier

    A unique source identifier.

  • Retrieves a source from the map

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func source<T>(withId id: String) throws -> T 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 to type.

  • Retrieves a source from the map

    This function is useful if you do not know the concrete type of the source you are fetching, or don’t need to know for your situation.

    Throws

    StyleError or type conversion errors

    Declaration

    Swift

    public func _source(withId id: String, type: Source.Type) throws -> 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 to type.

  • Gets the value of style source property.

    Declaration

    Swift

    public func sourceProperty(for sourceId: String, property: String) -> Any

    Parameters

    sourceId

    Style source identifier.

    property

    Style source property name.

    Return Value

    The value of the property in the source with sourceId.

  • Updates the data property of a given GeoJSONSource with a new value conforming to the GeoJSONObject protocol.

    Throws

    StyleError or type conversion errors

    Attention

    This method is only effective with sources of GeoJSONSource type, and cannot be used to update other source types.

    Declaration

    Swift

    public func updateGeoJSONSource<T>(withId id: String, geoJSON: T) throws where T : GeoJSONObject

    Parameters

    id

    The identifier representing the GeoJSON source.

    geoJSON

    The new GeoJSON to be associated with the source data. i.e. a feature or feature collection.

  • Gets the value of a style light property.

    Declaration

    Swift

    public func lightProperty(_ property: String) -> Any

    Parameters

    property

    Style light property name.

    Return Value

    Style light property value.

  • Sets a terrain on the style

    Throws

    An error describing why the operation was unsuccessful.

    Declaration

    Swift

    public func setTerrain(_ terrain: Terrain) throws

    Parameters

    terrain

    The Terrain that should be rendered

  • Gets the value of a style terrain property.

    Declaration

    Swift

    public func terrainProperty(_ property: String) -> Any

    Parameters

    property

    Style terrain property name.

    Return Value

    Style terrain property value.

  • Declaration

    Swift

    public var isLoaded: Bool { get }
  • uri

    Declaration

    Swift

    public var uri: StyleURI? { get set }
  • Declaration

    Swift

    public var JSON: String { get set }
  • Declaration

    Swift

    public var defaultCamera: CameraOptions { get }
  • Declaration

    Swift

    public var transition: TransitionOptions { get set }
  • Declaration

    Swift

    public func addImage(_ image: UIImage, id: String, sdf: Bool = false, stretchX: [ImageStretches] = [], stretchY: [ImageStretches] = [], content: ImageContent? = nil) throws
  • Declaration

    Swift

    public func removeImage(withId id: String) throws
  • Declaration

    Swift

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