CloudContainer.swift (1174B)
1 import CloudKit 2 3 /// Central identifiers for Crossmate's CloudKit containers. 4 /// 5 /// Synced game data lives in a *versioned* container. A breaking schema change 6 /// spins up a fresh container rather than mutating the append-only Production 7 /// schema in place; the app points at the current generation and abandons the 8 /// previous one's data. `legacyIdentifier` is retained only so a build can 9 /// still *read* the prior container to detect a user carrying pre-v4 data (the 10 /// v3→v4 reset flow), and can be dropped a release after launch. 11 /// 12 /// Bump `identifier` and add the new id to `Crossmate.entitlements` together on 13 /// the next breaking schema change. 14 enum CloudContainer { 15 /// The current synced-game container. 16 static let identifier = "iCloud.net.inqk.crossmate.v4" 17 18 /// The immediately-previous generation, kept readable one release for the 19 /// pre-v4 data probe. Remove once all users have moved off it. 20 static let legacyIdentifier = "iCloud.net.inqk.crossmate.v3" 21 22 static var container: CKContainer { CKContainer(identifier: identifier) } 23 static var legacyContainer: CKContainer { CKContainer(identifier: legacyIdentifier) } 24 }