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.
-
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 } -
init(id:region: state: size: createdAt: expiresAt: context: totalResources: downloadedResources: totalTileResources: ) 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
idThe unique identifier for the pack. Defaults to a new UUID.
regionThe region definition for the pack.
stateThe initial state of the pack. Defaults to
.pending.sizeThe initial size of the pack in bytes. Defaults to 0.
createdAtThe creation date of the pack. Defaults to the current date.
expiresAtThe expiration date of the pack. Defaults to 30 days from now.
contextOptional custom context data. Defaults to nil.
totalResourcesTotal resources for the pack. Defaults to 0.
downloadedResourcesDownloaded resources for the pack. Defaults to 0.
totalTileResourcesTotal tile resources for the pack. Defaults to 0.
-
Declaration
Swift
public init(from decoder: Decoder) throws