-
The
observable
class provides Publish&Subscribe functionality formap
andmap snapshotter
objects. The dedicated methods return a cancellable object whosecancel
method can be used to cancel an active subscription.Simplified diagram for events emitted by the map object. ┌─────────────┐ ┌─────────┐ ┌──────────────┐ │ Application │ │ Map │ │ResourceLoader│ └──────┬──────┘ └────┬────┘ └───────┬──────┘ │ │ │ ├───────setStyleURI────────▶│ │ │ ├───────────get style───────────▶│ │ │ │ │ │◀─────────style data────────────┤ │ │ │ │ ├─parse style─┐ │ │ │ │ │ │ StyleDataLoaded ◀─────────────┘ │ │◀───────type: Style────────┤ │ │ ├─────────get sprite────────────▶│ │ │ │ │ │◀────────sprite data────────────┤ │ │ │ │ ├──────parse sprite───────┐ │ │ │ │ │ │ StyleDataLoaded ◀─────────────────────────┘ │ │◀──────type: Sprite────────┤ │ │ ├─────get source TileJSON(s)────▶│ │ │ │ │ SourceDataLoaded │◀─────parse TileJSON data───────┤ │◀─────type: Metadata───────┤ │ │ │ │ │ │ │ │ StyleDataLoaded │ │ │◀──────type: Sources───────┤ │ │ ├──────────get tiles────────────▶│ │ │ │ │◀───────StyleLoaded────────┤ │ │ │ │ │ SourceDataLoaded │◀─────────tile data─────────────┤ │◀───────type: Tile─────────┤ │ │ │ │ │ │ │ │◀────RenderFrameStarted────┤ │ │ ├─────render─────┐ │ │ │ │ │ │ ◀────────────────┘ │ │◀───RenderFrameFinished────┤ │ │ ├──render, all tiles loaded──┐ │ │ │ │ │ │ ◀────────────────────────────┘ │ │◀────PerfStatsCollected────┤ │ │ │ │ │ │ │ │◀────────MapLoaded─────────┤ │ │ │ │ │ │ │ │◀─────────MapIdle──────────┤ │ │ ┌ ─── ─┴─ ─── ┐ │ │ │ offline │ │ │ └ ─── ─┬─ ─── ┘ │ │ │ │ ├─────────setCamera────────▶│ │ │ ├───────────get tiles───────────▶│ │ │ │ │ │┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │◀─────────MapIdle──────────┤ waiting for connectivity │ │ │ ││ Map renders cached data │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ │ │ │ │
Declaration
Objective-C
@interface MBMObservable : NSObject
Swift
class Observable : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(MapLoadedCallback) typedef void (^MBMMapLoadedCallback)(MBMMapLoaded * _Nonnull mapLoaded)
Swift
typealias MapLoadedCallback = (MBMMapLoaded) -> Void
-
The style has been fully loaded, and the
See moremap
has rendered all visible tiles. The event will be emitted only once for the current style. If it is required to observe an event where all required resources are loaded or rendered, please check the following events:MapIdle
,StyleDataLoaded
, andRenderFrameFinished
.Declaration
Objective-C
@interface MBMMapLoaded : NSObject
Swift
class MapLoaded : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(MapIdleCallback) typedef void (^MBMMapIdleCallback)(MBMMapIdle * _Nonnull mapIdle)
Swift
typealias MapIdleCallback = (MBMMapIdle) -> Void
-
The
map
has entered the idle state. Themap
is idle when there are no ongoing animations, transitions and themap
has rendered all requested non-volatile tiles (e.g., live traffic tiles). The event will not be emitted ifsetUserAnimationInProgress
and / orsetGestureInProgress
is set totrue
.The
See moreMapIdle
will also be emitted after expired resources are re-fetched andmap
re-renders the new data.Declaration
Objective-C
@interface MBMMapIdle : NSObject
Swift
class MapIdle : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(MapLoadingErrorCallback) typedef void (^MBMMapLoadingErrorCallback)(MBMMapLoadingError * _Nonnull mapLoadingError)
Swift
typealias MapLoadingErrorCallback = (MBMMapLoadingError) -> Void
-
Describes an error that has occurred while loading the
map
. Thetype
property defines what resource could not be loaded, and themessage
property will contain a descriptive error message.- In case of
MapLoadingErrorType.Source
orMapLoadingErrorType.Tile
loading errors, thesourceId
property will contain the source’s name. - In case of
MapLoadingErrorType.Tile
loading errors,tileId
will contain theCanonicalTileID
of the tile.
Declaration
Objective-C
@interface MBMMapLoadingError : NSObject
Swift
class MapLoadingError : NSObject
- In case of
-
The enumeration defines map loading errors.
See moreDeclaration
Objective-C
enum MBMMapLoadingErrorType : NSInteger {}
Swift
enum MapLoadingErrorType : Int, @unchecked Sendable
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(StyleLoadedCallback) typedef void (^MBMStyleLoadedCallback)(MBMStyleLoaded * _Nonnull styleLoaded)
Swift
typealias StyleLoadedCallback = (MBMStyleLoaded) -> Void
-
The requested style has been fully loaded, including specified sprite, and sources’ metadata.
Note: The style specified sprite would be marked as loaded even with a sprite loading error (an error will be emitted via
See moreMapLoadingError
). Sprite loading error is not fatal, and won’t block the map rendering; thus, the event will still be emitted if the style and sources are fully loaded.Declaration
Objective-C
@interface MBMStyleLoaded : NSObject
Swift
class StyleLoaded : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(StyleDataLoadedCallback) typedef void (^MBMStyleDataLoadedCallback)(MBMStyleDataLoaded * _Nonnull styleDataLoaded)
Swift
typealias StyleDataLoadedCallback = (MBMStyleDataLoaded) -> Void
-
The style data has been loaded. The event will be emitted once for each
StyleDataLoadedType
type during style loading. If a new style is set, events will be emitted again for the newly set style.These events should not be used for runtime styling (using
RuntimeStylingOptions
is preferred), but only to check things like: loading time, loading progress of particular source, spritesheet, etc.Note: The event may be emitted synchronously, for example, when
See moresetStyleJSON
is used to load style.Declaration
Objective-C
@interface MBMStyleDataLoaded : NSObject
Swift
class StyleDataLoaded : NSObject
-
The enumeration defines the type of loaded style data.
See moreDeclaration
Objective-C
enum MBMStyleDataLoadedType : NSInteger {}
Swift
enum StyleDataLoadedType : Int, @unchecked Sendable
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(SourceDataLoadedCallback) typedef void (^MBMSourceDataLoadedCallback)(MBMSourceDataLoaded * _Nonnull sourceDataLoaded)
Swift
typealias SourceDataLoadedCallback = (MBMSourceDataLoaded) -> Void
-
The
SourceDataLoaded
event is emitted when source data is loaded.Note: The event will be emitted synchronously in cases when the source’s metadata is available when a source is added to the style.
See moreDeclaration
Objective-C
@interface MBMSourceDataLoaded : NSObject
Swift
class SourceDataLoaded : NSObject
-
The enumeration defines the type of loaded source data.
See moreDeclaration
Objective-C
enum MBMSourceDataLoadedType : NSInteger {}
Swift
enum SourceDataLoadedType : Int, @unchecked Sendable
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(SourceAddedCallback) typedef void (^MBMSourceAddedCallback)(MBMSourceAdded * _Nonnull sourceAdded)
Swift
typealias SourceAddedCallback = (MBMSourceAdded) -> Void
-
The source has been added with
addStyleSource
method.Note: The event is emitted synchronously; therefore, it is possible to read added source’s properties immediately.
See moreDeclaration
Objective-C
@interface MBMSourceAdded : NSObject
Swift
class SourceAdded : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(SourceRemovedCallback) typedef void (^MBMSourceRemovedCallback)(MBMSourceRemoved * _Nonnull sourceRemoved)
Swift
typealias SourceRemovedCallback = (MBMSourceRemoved) -> Void
-
The source has been removed with
removeStyleSource
method.Note: The event is emitted synchronously; thus,
See moregetStyleSources
will be in sync when theobserver
receives the notification.Declaration
Objective-C
@interface MBMSourceRemoved : NSObject
Swift
class SourceRemoved : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(StyleImageMissingCallback) typedef void (^MBMStyleImageMissingCallback)(MBMStyleImageMissing * _Nonnull styleImageMissing)
Swift
typealias StyleImageMissingCallback = (MBMStyleImageMissing) -> Void
-
A style needs an image that is missing from the sprite sheet. This event is emitted when the
map
renders visible tiles, and one of the required images is missing in the sprite sheet. The event observer has to provide the missing image by calling theaddStyleImage
method.Note: Images added as a result of the
See moreStyleImageMissing
event will be treated as user-added images, and when the engine no longer needs a user-provided image, themap
will emitStyleImageRemoveUnused
event.Declaration
Objective-C
@interface MBMStyleImageMissing : NSObject
Swift
class StyleImageMissing : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(StyleImageRemoveUnusedCallback) typedef void (^MBMStyleImageRemoveUnusedCallback)(MBMStyleImageRemoveUnused * _Nonnull styleImageRemoveUnused)
Swift
typealias StyleImageRemoveUnusedCallback = (MBMStyleImageRemoveUnused) -> Void
-
An image requested by the
map
through theStyleImageMissing
event is no longer needed and can be removed using theremoveStyleImage
method. The application can decide whether the image should be kept or removed.Note: If there are no subscribers for the
See moreStyleImageRemoveUnused
event, themap
will automatically remove the unused image.Declaration
Objective-C
@interface MBMStyleImageRemoveUnused : NSObject
Swift
class StyleImageRemoveUnused : NSObject
-
This event is emitted whenever the visible viewport changes its size due to the invocation of the
See moresetSize
andsetBounds
methods or when the camera is modified by calling camera methods. The event is emitted synchronously so that an updated camera state can be read immediately.Declaration
Objective-C
@interface MBMCameraChanged : NSObject
Swift
class CameraChanged : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(CameraChangedCallback) typedef void (^MBMCameraChangedCallback)(MBMCameraChanged * _Nonnull cameraChanged)
Swift
typealias CameraChangedCallback = (MBMCameraChanged) -> Void
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(RenderFrameStartedCallback) typedef void (^MBMRenderFrameStartedCallback)(MBMRenderFrameStarted * _Nonnull renderFrameStarted)
Swift
typealias RenderFrameStartedCallback = (MBMRenderFrameStarted) -> Void
-
The
map
started rendering a frame.Note: The
See moremap
will emit the event asynchronously so the user-provided callback does not stall the rendering pipeline.Declaration
Objective-C
@interface MBMRenderFrameStarted : NSObject
Swift
class RenderFrameStarted : NSObject
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(RenderFrameFinishedCallback) typedef void (^MBMRenderFrameFinishedCallback)(MBMRenderFrameFinished * _Nonnull renderFrameFinished)
Swift
typealias RenderFrameFinishedCallback = (MBMRenderFrameFinished) -> Void
-
The
map
finished rendering a frame.Note: The
See moremap
will emit the event asynchronously so the user-provided callback does not stall the rendering pipeline.Declaration
Objective-C
@interface MBMRenderFrameFinished : NSObject
Swift
class RenderFrameFinished : NSObject
-
The enumeration defines the rendering mode for the rendered frame.
See moreDeclaration
Objective-C
enum MBMRenderModeType : NSInteger {}
Swift
enum RenderModeType : Int, @unchecked Sendable
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(ResourceRequestCallback) typedef void (^MBMResourceRequestCallback)(MBMResourceRequest * _Nonnull resourceRequest)
Swift
typealias ResourceRequestCallback = (MBMResourceRequest) -> Void
-
The
See moreResourceRequest
event allows the application to observe resource requests made by amap
ormap snapshotter
object.Declaration
Objective-C
@interface MBMResourceRequest : NSObject
Swift
class ResourceRequest : NSObject
-
The structure defines the information about the resource request.
See moreDeclaration
Objective-C
@interface MBMRequestInfo : NSObject
Swift
class RequestInfo : NSObject
-
The structure defines the information about the response for the resource request.
See moreDeclaration
Objective-C
@interface MBMResponseInfo : NSObject
Swift
class ResponseInfo : NSObject
-
The structure defines the information about errors that may occur during a resource request.
See moreDeclaration
Objective-C
@interface MBMResourceRequestError : NSObject
Swift
class ResourceRequestError : NSObject
-
The enumeration defines the error type that may occur during a resource request.
See moreDeclaration
Objective-C
enum MBMRequestErrorType : NSInteger {}
Swift
enum RequestErrorType : Int, @unchecked Sendable
-
The enumeration defines the type of data source.
See moreDeclaration
Objective-C
enum MBMRequestDataSourceType : NSInteger {}
Swift
enum RequestDataSourceType : Int, @unchecked Sendable
-
The enumeration defines the method used to make a resource request.
See moreDeclaration
Objective-C
enum MBMRequestLoadingMethodType : NSInteger {}
Swift
enum RequestLoadingMethodType : Int, @unchecked Sendable
-
The enumeration defines the priority of a resource request.
See moreDeclaration
Objective-C
enum MBMRequestPriorityType : NSInteger {}
Swift
enum RequestPriorityType : Int, @unchecked Sendable
-
The enumeration defines the type of resource requested by the
See moremap
.Declaration
Objective-C
enum MBMRequestResourceType : NSInteger {}
Swift
enum RequestResourceType : Int, @unchecked Sendable
-
The enumeration defines the source type that provides the requested resource.
See moreDeclaration
Objective-C
enum MBMResponseSourceType : NSInteger {}
Swift
enum ResponseSourceType : Int, @unchecked Sendable
-
Undocumented
Declaration
Objective-C
NS_SWIFT_NAME(GenericEventCallback) typedef void (^MBMGenericEventCallback)(MBMGenericEvent * _Nonnull genericEvent)
Swift
typealias GenericEventCallback = (MBMGenericEvent) -> Void
-
The generic event type.
See moreDeclaration
Objective-C
@interface MBMGenericEvent : NSObject
Swift
class GenericEvent : NSObject
-
The time interval of an event. The
See morebegin
property represents the time origin of an event, and theend
property represents the time when the particular operation is complete. The timestamps are sampled at the origin and do not include the time required to dispatch an event.Declaration
Objective-C
@interface MBMEventTimeInterval : NSObject
Swift
class EventTimeInterval : NSObject
-
Undocumented
Declaration
Objective-C
NSString* MBMMapLoadingErrorTypeToString(MBMMapLoadingErrorType map_loading_error_type)
Swift
func MBMMapLoadingErrorTypeToString(_ map_loading_error_type: MapLoadingErrorType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRenderModeTypeToString(MBMRenderModeType render_mode_type)
Swift
func MBMRenderModeTypeToString(_ render_mode_type: RenderModeType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRequestDataSourceTypeToString(MBMRequestDataSourceType request_data_source_type)
Swift
func MBMRequestDataSourceTypeToString(_ request_data_source_type: RequestDataSourceType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRequestErrorTypeToString(MBMRequestErrorType request_error_type)
Swift
func MBMRequestErrorTypeToString(_ request_error_type: RequestErrorType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRequestLoadingMethodTypeToString(MBMRequestLoadingMethodType request_loading_method_type)
Swift
func MBMRequestLoadingMethodTypeToString(_ request_loading_method_type: RequestLoadingMethodType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRequestPriorityTypeToString(MBMRequestPriorityType request_priority_type)
Swift
func MBMRequestPriorityTypeToString(_ request_priority_type: RequestPriorityType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMRequestResourceTypeToString(MBMRequestResourceType request_resource_type)
Swift
func MBMRequestResourceTypeToString(_ request_resource_type: RequestResourceType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMResponseSourceTypeToString(MBMResponseSourceType response_source_type)
Swift
func MBMResponseSourceTypeToString(_ response_source_type: ResponseSourceType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMSourceDataLoadedTypeToString(MBMSourceDataLoadedType source_data_loaded_type)
Swift
func MBMSourceDataLoadedTypeToString(_ source_data_loaded_type: SourceDataLoadedType) -> String!
-
Undocumented
Declaration
Objective-C
NSString* MBMStyleDataLoadedTypeToString(MBMStyleDataLoadedType style_data_loaded_type)
Swift
func MBMStyleDataLoadedTypeToString(_ style_data_loaded_type: StyleDataLoadedType) -> String!