MBMStyleManager


@interface MBMStyleManager : MBMObservable

Interface for managing style of the map.

  • Get the URI of the current style in use.

    Declaration

    Objective-C

    - (nonnull NSString *)getStyleURI;

    Swift

    func getStyleURI() -> String

    Return Value

    A string containing a style URI.

  • Load style from provided URI.

    This is an asynchronous call. To check the result of this operation the user must register an observer observing MapLoaded or MapLoadingError events. In case of successful style load, StyleLoaded event will be also emitted.

    Declaration

    Objective-C

    - (void)setStyleURIForUri:(nonnull NSString *)uri;

    Swift

    func setStyleURIForUri(_ uri: String)

    Parameters

    uri

    URI where the style should be loaded from.

  • Get the JSON serialization string of the current style in use.

    Declaration

    Objective-C

    - (nonnull NSString *)getStyleJSON;

    Swift

    func getStyleJSON() -> String

    Return Value

    A JSON string containing a serialized style.

  • Load the style from a provided JSON string.

    Declaration

    Objective-C

    - (void)setStyleJSONForJson:(nonnull NSString *)json;

    Swift

    func setStyleJSONForJson(_ json: String)

    Parameters

    json

    A JSON string containing a serialized style.

  • Returns the map style’s default camera, if any, or a default camera otherwise. The map style’s default camera is defined as follows:

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

    Declaration

    Objective-C

    - (nonnull MBMCameraOptions *)getStyleDefaultCamera;

    Swift

    func getStyleDefaultCamera() -> MBMCameraOptions

    Return Value

    The default camera options of the current style in use.

  • Returns the map style’s transition options. By default, the style parser will attempt to read the style default transition options, if any, fallbacking to an immediate transition otherwise. Transition options can be overriden via setStyleTransition, but the options are reset once a new style has been loaded.

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

    Declaration

    Objective-C

    - (nonnull MBMTransitionOptions *)getStyleTransition;

    Swift

    func getStyleTransition() -> MBMTransitionOptions

    Return Value

    The transition options of the current style in use.

  • Overrides the map style’s transition options with user-provided options.

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

    Declaration

    Objective-C

    - (void)setStyleTransitionForTransitionOptions:
        (nonnull MBMTransitionOptions *)transitionOptions;

    Swift

    func setStyleTransitionFor(_ transitionOptions: MBMTransitionOptions)

    Parameters

    transitionOptions

    The transition options.

  • Checks whether a given style layer exists.

    Declaration

    Objective-C

    - (BOOL)styleLayerExistsForLayerId:(nonnull NSString *)layerId;

    Swift

    func styleLayerExists(forLayerId layerId: String) -> Bool

    Parameters

    layerId

    Style layer identifier.

    Return Value

    A true value if the given style layer exists, false otherwise.

  • Returns the existing style layers.

    Declaration

    Objective-C

    - (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleLayers;

    Swift

    func getStyleLayers() -> [MBMStyleObjectInfo]

    Return Value

    The list containing the information about existing style layer objects.

  • Gets the value of style layer property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)
        getStyleLayerPropertyForLayerId:(nonnull NSString *)layerId
                               property:(nonnull NSString *)property;

    Swift

    func getStyleLayerProperty(forLayerId layerId: String, property: String) -> MBMStylePropertyValue

    Parameters

    layerId

    A style layer identifier.

    property

    The style layer property name.

    Return Value

    The style property value.

  • Gets the default value of style layer property

    Declaration

    Objective-C

    + (nonnull MBMStylePropertyValue *)
        getStyleLayerPropertyDefaultValueForLayerType:(nonnull NSString *)layerType
                                             property:(nonnull NSString *)property;

    Swift

    class func getStyleLayerPropertyDefaultValue(forLayerType layerType: String, property: String) -> MBMStylePropertyValue

    Parameters

    layerType

    A style layer type.

    property

    The style layer property name.

    Return Value

    The default style property value for a given layerType and property name.

  • Gets the value of style source property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)
        getStyleSourcePropertyForSourceId:(nonnull NSString *)sourceId
                                 property:(nonnull NSString *)property;

    Swift

    func getStyleSourceProperty(forSourceId sourceId: String, property: String) -> MBMStylePropertyValue

    Parameters

    sourceId

    A style source identifier.

    property

    The style source property name.

    Return Value

    The value of a property in the source with a sourceId.

  • Gets the default value of style source property.

    Declaration

    Objective-C

    + (nonnull MBMStylePropertyValue *)
        getStyleSourcePropertyDefaultValueForSourceType:
            (nonnull NSString *)sourceType
                                               property:
                                                   (nonnull NSString *)property;

    Swift

    class func getStyleSourcePropertyDefaultValue(forSourceType sourceType: String, property: String) -> MBMStylePropertyValue

    Parameters

    sourceType

    A style source type.

    property

    The style source property name.

    Return Value

    The default value of a property for the sources with of a sourceType type.

  • Checks whether a given style source exists.

    Declaration

    Objective-C

    - (BOOL)styleSourceExistsForSourceId:(nonnull NSString *)sourceId;

    Swift

    func styleSourceExists(forSourceId sourceId: String) -> Bool

    Parameters

    sourceId

    A style source identifier.

    Return Value

    true if the given source exists, false otherwise.

  • Returns the existing style sources.

    Declaration

    Objective-C

    - (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleSources;

    Swift

    func getStyleSources() -> [MBMStyleObjectInfo]

    Return Value

    The list containing the information about existing style source objects.

  • Gets the value of a style light property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)getStyleLightPropertyForProperty:
        (nonnull NSString *)property;

    Swift

    func getStyleLightProperty(forProperty property: String) -> MBMStylePropertyValue

    Parameters

    property

    The style light property name.

    Return Value

    The style light property value.

  • Gets the value of a style atmosphere property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)getStyleAtmospherePropertyForProperty:
        (nonnull NSString *)property;

    Swift

    func getStyleAtmosphereProperty(forProperty property: String) -> MBMStylePropertyValue

    Parameters

    property

    The style atmosphere property name.

    Return Value

    The style atmosphere property value.

  • Gets the value of a style terrain property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)getStyleTerrainPropertyForProperty:
        (nonnull NSString *)property;

    Swift

    func getStyleTerrainProperty(forProperty property: String) -> MBMStylePropertyValue

    Parameters

    property

    The style terrain property name.

    Return Value

    The style terrain property value.

  • Gets the value of a style projection property.

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)getStyleProjectionPropertyForProperty:
        (nonnull NSString *)property;

    Swift

    func getStyleProjectionProperty(forProperty property: String) -> MBMStylePropertyValue

    Parameters

    property

    The style projection property name.

    Return Value

    The style projection property value.

  • Get an image from the style.

    Declaration

    Objective-C

    - (nullable MBMImage *)getStyleImageForImageId:(nonnull NSString *)imageId;

    Swift

    func getStyleImage(forImageId imageId: String) -> MBMImage?

    Parameters

    imageId

    The identifier of the image.

    Return Value

    The image for the given imageId, or empty if no image is associated with the imageId.

  • Checks whether an image exists.

    Declaration

    Objective-C

    - (BOOL)hasStyleImageForImageId:(nonnull NSString *)imageId;

    Swift

    func hasStyleImage(forImageId imageId: String) -> Bool

    Parameters

    imageId

    The identifier of the image.

    Return Value

    True if image exists, false otherwise.

  • Checks whether a model exists.

    Declaration

    Objective-C

    - (BOOL)hasStyleModelForModelId:(nonnull NSString *)modelId;

    Swift

    func hasStyleModel(forModelId modelId: String) -> Bool

    Parameters

    modelId

    The identifier of the model.

    Return Value

    True if model exists, false otherwise.

  • Check if the style is completely loaded.

    Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via MapLoadingError). Sprite loading error is not fatal and we don’t want it to block the map rendering, thus the function will still return true if style and sources are fully loaded.

    Declaration

    Objective-C

    - (BOOL)isStyleLoaded;

    Swift

    func isStyleLoaded() -> Bool

    Return Value

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

  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleLayerForProperties:(nonnull id)properties
                                                                layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));

    Swift

    func addStyleLayer(forProperties properties: Any, layerPosition: MBMLayerPosition?) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleCustomLayerForLayerId:(nonnull NSString *)layerId
                                                                       layerHost:(nonnull id<MBMCustomLayerHost>)layerHost
                                                                   layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addPersistentStyleLayerForProperties:(nonnull id)properties
                                                                          layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));

    Swift

    func addPersistentStyleLayer(forProperties properties: Any, layerPosition: MBMLayerPosition?) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addPersistentStyleCustomLayerForLayerId:(nonnull NSString *)layerId
                                                                                 layerHost:(nonnull id<MBMCustomLayerHost>)layerHost
                                                                             layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNumber *, NSString *> *)isStyleLayerPersistentForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

    func isStyleLayerPersistent(forLayerId layerId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)removeStyleLayerForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

    func removeStyleLayer(forLayerId layerId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)moveStyleLayerForLayerId:(nonnull NSString *)layerId
                                                              layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));

    Swift

    func moveStyleLayer(forLayerId layerId: String, layerPosition: MBMLayerPosition?) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLayerPropertyForLayerId:(nonnull NSString *)layerId
                                                                          property:(nonnull NSString *)property
                                                                             value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleLayerPropertyForLayerId(_ layerId: String, property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<id, NSString *> *)getStyleLayerPropertiesForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

    func getStyleLayerProperties(forLayerId layerId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLayerPropertiesForLayerId:(nonnull NSString *)layerId
                                                                          properties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleLayerPropertiesForLayerId(_ layerId: String, properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleSourceForSourceId:(nonnull NSString *)sourceId
                                                                  properties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func addStyleSource(forSourceId sourceId: String, properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleSourcePropertyForSourceId:(nonnull NSString *)sourceId
                                                                            property:(nonnull NSString *)property
                                                                               value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleSourcePropertyForSourceId(_ sourceId: String, property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<id, NSString *> *)getStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));

    Swift

    func getStyleSourceProperties(forSourceId sourceId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId
                                                                            properties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleSourcePropertiesForSourceId(_ sourceId: String, properties: Any) -> MBXExpected
  • Deprecated

    Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleGeoJSONSourceDataForSourceId:(nonnull NSString *)sourceId
                                                                                   data:(nonnull MBMGeoJSONSourceData *)data __attribute((ns_returns_retained)) NS_REFINED_FOR_SWIFT __attribute__((deprecated));
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleGeoJSONSourceDataForSourceId:(nonnull NSString *)sourceId
                                                                                 dataId:(nonnull NSString *)dataId
                                                                                   data:(nonnull MBMGeoJSONSourceData *)data __attribute((ns_returns_retained)) NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)updateStyleImageSourceImageForSourceId:(nonnull NSString *)sourceId
                                                                                    image:(nonnull MBMImage *)image __attribute((ns_returns_retained));

    Swift

    func updateStyleImageSourceImage(forSourceId sourceId: String, image: MBMImage) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)removeStyleSourceForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));

    Swift

    func removeStyleSource(forSourceId sourceId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLightForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleLightForProperties(_ properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLightPropertyForProperty:(nonnull NSString *)property
                                                                              value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleLightPropertyForProperty(_ property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleLights __attribute((ns_returns_retained));

    Swift

    func getStyleLights() -> [MBMStyleObjectInfo]
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLightsForLights:(nonnull id)lights __attribute((ns_returns_retained));

    Swift

    func setStyleLightsForLights(_ lights: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBMStylePropertyValue *)getStyleLightPropertyForId:(nonnull NSString *)id
                                                         property:(nonnull NSString *)property __attribute((ns_returns_retained));

    Swift

    func getStyleLightProperty(forId id: String, property: String) -> MBMStylePropertyValue
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleLightPropertyForId:(nonnull NSString *)id
                                                                     property:(nonnull NSString *)property
                                                                        value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleLightPropertyForId(_ id: String, property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleAtmosphereForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleAtmosphereForProperties(_ properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleAtmospherePropertyForProperty:(nonnull NSString *)property
                                                                                   value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleAtmospherePropertyForProperty(_ property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleTerrainForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleTerrainForProperties(_ properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleTerrainPropertyForProperty:(nonnull NSString *)property
                                                                                value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleTerrainPropertyForProperty(_ property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleProjectionForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

    func setStyleProjectionForProperties(_ properties: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleProjectionPropertyForProperty:(nonnull NSString *)property
                                                                                   value:(nonnull id)value __attribute((ns_returns_retained));

    Swift

    func setStyleProjectionPropertyForProperty(_ property: String, value: Any) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleImageForImageId:(nonnull NSString *)imageId
                                                                     scale:(float)scale
                                                                     image:(nonnull MBMImage *)image
                                                                       sdf:(BOOL)sdf
                                                                  stretchX:(nonnull NSArray<MBMImageStretches *> *)stretchX
                                                                  stretchY:(nonnull NSArray<MBMImageStretches *> *)stretchY
                                                                   content:(nullable MBMImageContent *)content __attribute((ns_returns_retained));

    Swift

    func addStyleImage(forImageId imageId: String, scale: Float, image: MBMImage, sdf: Bool, stretchX: [MBMImageStretches], stretchY: [MBMImageStretches], content: MBMImageContent?) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)removeStyleImageForImageId:(nonnull NSString *)imageId __attribute((ns_returns_retained));

    Swift

    func removeStyleImage(forImageId imageId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleModelForModelId:(nonnull NSString *)modelId
                                                                  modelUri:(nonnull NSString *)modelUri __attribute((ns_returns_retained));

    Swift

    func addStyleModel(forModelId modelId: String, modelUri: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)removeStyleModelForModelId:(nonnull NSString *)modelId __attribute((ns_returns_retained));

    Swift

    func removeStyleModel(forModelId modelId: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addStyleCustomGeometrySourceForSourceId:(nonnull NSString *)sourceId
                                                                                   options:(nonnull MBMCustomGeometrySourceOptions *)options __attribute((ns_returns_retained));

    Swift

    func addStyleCustomGeometrySource(forSourceId sourceId: String, options: MBMCustomGeometrySourceOptions) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)setStyleCustomGeometrySourceTileDataForSourceId:(nonnull NSString *)sourceId
                                                                                            tileId:(nonnull MBMCanonicalTileID *)tileId
                                                                                 featureCollection:(nonnull NSArray<MBXFeature *> *)featureCollection __attribute((ns_returns_retained));

    Swift

    func setStyleCustomGeometrySourceTileDataForSourceId(_ sourceId: String, tileId: MBMCanonicalTileID, featureCollection: [MBXFeature]) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)invalidateStyleCustomGeometrySourceTileForSourceId:(nonnull NSString *)sourceId
                                                                                               tileId:(nonnull MBMCanonicalTileID *)tileId __attribute((ns_returns_retained));

    Swift

    func invalidateStyleCustomGeometrySourceTile(forSourceId sourceId: String, tileId: MBMCanonicalTileID) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)invalidateStyleCustomGeometrySourceRegionForSourceId:(nonnull NSString *)sourceId
                                                                                                 bounds:(nonnull MBMCoordinateBounds *)bounds __attribute((ns_returns_retained));

    Swift

    func invalidateStyleCustomGeometrySourceRegion(forSourceId sourceId: String, bounds: MBMCoordinateBounds) -> MBXExpected