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 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.

  • 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.

  • 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 *)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 *)addStyleCustomLayerForLayerId:(nonnull NSString *)layerId
                                                 layerHost:(nonnull id<MBMCustomLayerHost>)layerHost
                                             layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)addPersistentStyleCustomLayerForLayerId:(nonnull NSString *)layerId
                                                           layerHost:(nonnull id<MBMCustomLayerHost>)layerHost
                                                       layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected *)isStyleLayerPersistentForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)removeStyleLayerForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)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 *)getStyleLayerPropertiesForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)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 *)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 *)getStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)setStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId
                                                      properties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)removeStyleSourceForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)setStyleLightForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 MBXExpected *)setStyleTerrainForProperties:(nonnull id)properties __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)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 *)removeStyleImageForImageId:(nonnull NSString *)imageId __attribute((ns_returns_retained));

    Swift

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

    Declaration

    Objective-C

    - (nonnull MBXExpected *)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 *)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 *)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 *)invalidateStyleCustomGeometrySourceRegionForSourceId:(nonnull NSString *)sourceId
                                                                           bounds:(nonnull MBMCoordinateBounds *)bounds __attribute((ns_returns_retained));

    Swift

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