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

    level

    The desired SDK log level.

  • Sets the MapTiler API key.

    Declaration

    Swift

    public func setAPIKey(_ apiKey: String, for map: MTMapView? = nil)

    Parameters

    apiKey

    The MapTiler API Key.

    map

    Map view to apply to.

  • Returns the MapTiler API key.

    Declaration

    Swift

    public func getAPIKey() -> String?
  • Sets the caching mechanism.

    Note

    Enabled by default

    Declaration

    Swift

    public func setCaching(_ isEnabled: Bool, for map: MTMapView)

    Parameters

    isEnabled

    Boolean indicating whether caching is enabled.

    map

    Map view to apply to.

  • Sets the unit of measurement.

    Note

    Default: .metric

    Declaration

    Swift

    public func setUnit(_ unit: MTUnit, for map: MTMapView)

    Parameters

    unit

    The MTUnit type.

    map

    Map view to apply to.

  • Returns the unit of measurement.

    Declaration

    Swift

    public func getUnit() -> MTUnit?
  • Sets the telemetry.

    Note

    Enabled by default

    Declaration

    Swift

    public func setTelemetry(_ isEnabled: Bool, for map: MTMapView)

    Parameters

    isEnabled

    Boolean indicating whether telemetry is enabled.

    map

    Map view to apply to.