MTConfig
public actor MTConfig
Object representing the SDK global settings.
Exposes properties and options such as API Key and caching preferences.
-
Undocumented
Declaration
Swift
public static let shared: MTConfig -
SDK version
Declaration
Swift
public static let version: String -
SDK log level.
Declaration
Swift
public private(set) var logLevel: MTLogLevel { get } -
Boolean indicating whether caching is enabled.
Note
Defaults to true.Declaration
Swift
public private(set) var isCachingEnabled: Bool { get } -
Boolean indicating whether session logic is enabled.
This allows MapTiler to enable “session based billing”.
Note
Defaults to true.See also
https://docs.maptiler.com/guides/maps-apis/maps-platform/what-is-map-session-in-maptiler-cloud/Declaration
Swift
public private(set) var isSessionLogicEnabled: Bool { get } -
Boolean indicating whether telemetry is enabled.
The telemetry is very valuable to the team at MapTiler because it shares information about where to add the extra effort. It also helps spotting some incompatibility issues that may arise between the SDK and a specific version of a module. It consist in sending the SDK version, API Key, MapTiler session ID, if tile caching is enabled, if language specified at initialization, if terrain is activated at initialization, if globe projection is activated at initialization.
Note
Defaults to true.Declaration
Swift
public private(set) var isTelemetryEnabled: Bool { get } -
Sets the SDK log level.
Declaration
Swift
public func setLogLevel(_ level: MTLogLevel)Parameters
levelThe desired SDK log level.
-
Sets the MapTiler API key.
Declaration
Swift
public func setAPIKey(_ apiKey: String, for map: MTMapView? = nil)Parameters
apiKeyThe MapTiler API Key.
mapMap view to apply to.
-
Returns the MapTiler API key.
Declaration
Swift
public func getAPIKey() -> String? -
Returns the current MapTiler session ID.
Declaration
Swift
public func getMaptilerSessionId() -> String? -
Sets the caching mechanism.
Note
Enabled by defaultDeclaration
Swift
public func setCaching(_ isEnabled: Bool, for map: MTMapView)Parameters
isEnabledBoolean indicating whether caching is enabled.
mapMap view to apply to.
-
Sets the session logic.
Make sure to call before map init or use MTMapOptions to supply before map init.
Note
Enabled by defaultSee also
https://docs.maptiler.com/guides/maps-apis/maps-platform/what-is-map-session-in-maptiler-cloud/Declaration
Swift
public func setSessionLogic(_ isEnabled: Bool, for map: MTMapView)Parameters
isEnabledBoolean indicating whether session logic is enabled.
mapMap view to apply to.
-
Returns the unit of measurement.
Declaration
Swift
public func getUnit() -> MTUnit? -
Sets the maximum number of tiles allowed for a single offline region download. This prevents users from accidentally downloading massive areas that consume too much storage. Note: MapTiler enforces an internal safety limit (currently 15,000 tiles). If you provide a value higher than the internal limit, the internal limit will be enforced.
Declaration
Swift
public func setOfflineMaxTileCount(_ maxTileCount: Int)Parameters
maxTileCountThe maximum allowed tiles (default is 15,000).
-
Sets the telemetry.
Note
Enabled by defaultDeclaration
Swift
public func setTelemetry(_ isEnabled: Bool, for map: MTMapView)Parameters
isEnabledBoolean indicating whether telemetry is enabled.
mapMap view to apply to.
-
Handles events for the background URLSession. Call this from your AppDelegate’s
application(_:handleEventsForBackgroundURLSession:completionHandler:)Declaration
Swift
public static func handleEventsForBackgroundURLSession( identifier: String, completionHandler: @escaping () -> Void )Parameters
identifierThe identifier of the URLSession.
completionHandlerThe completion handler provided by the app delegate.