MTOfflinePackMetadata

public struct MTOfflinePackMetadata : Codable, Equatable, Sendable

Metadata information about an offline pack.

This model is used to persist pack information such as its identifier, current state, total size, and creation date.

  • id

    The unique identifier of the pack.

    Declaration

    Swift

    public let id: UUID
  • The current state of the pack.

    Declaration

    Swift

    public var state: MTOfflinePackState
  • The total size of the pack in bytes.

    Declaration

    Swift

    public var size: Int64
  • The date when the pack was created.

    Declaration

    Swift

    public let createdAt: Date
  • The date when the pack expires.

    Declaration

    Swift

    public var expiresAt: Date
  • Optional custom data, typically used to store application-specific context (e.g. JSON data).

    Declaration

    Swift

    public let context: Data?
  • The region definition specifying the bounding box, zoom levels, and style.

    Declaration

    Swift

    public let region: MTOfflineRegionDefinition
  • Total number of resources required for the pack.

    Declaration

    Swift

    public var totalResources: Int
  • Total number of tile resources required for the pack.

    Declaration

    Swift

    public var totalTileResources: Int
  • Number of resources that have been successfully downloaded.

    Declaration

    Swift

    public var downloadedResources: Int
  • Returns true if the pack has passed its expiration date.

    Declaration

    Swift

    public var isExpired: Bool { get }
  • Initializes a new offline pack metadata object.

    Declaration

    Swift

    public init(
        id: UUID = UUID(),
        region: MTOfflineRegionDefinition,
        state: MTOfflinePackState = .pending,
        size: Int64 = 0,
        createdAt: Date = Date(),
        expiresAt: Date? = nil,
        context: Data? = nil,
        totalResources: Int = 0,
        downloadedResources: Int = 0,
        totalTileResources: Int = 0
    )

    Parameters

    id

    The unique identifier for the pack. Defaults to a new UUID.

    region

    The region definition for the pack.

    state

    The initial state of the pack. Defaults to .pending.

    size

    The initial size of the pack in bytes. Defaults to 0.

    createdAt

    The creation date of the pack. Defaults to the current date.

    expiresAt

    The expiration date of the pack. Defaults to 30 days from now.

    context

    Optional custom context data. Defaults to nil.

    totalResources

    Total resources for the pack. Defaults to 0.

    downloadedResources

    Downloaded resources for the pack. Defaults to 0.

    totalTileResources

    Total tile resources for the pack. Defaults to 0.

  • Declaration

    Swift

    public init(from decoder: Decoder) throws