Explorar o código

enable lightweight migration

polscm32 %!s(int64=2) %!d(string=hai) anos
pai
achega
c0fa88f364
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      Model/CoreDataStack.swift

+ 5 - 0
Model/CoreDataStack.swift

@@ -62,6 +62,11 @@ class CoreDataStack: ObservableObject {
         /// - Tag: persistentHistoryTracking
         description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
 
+        // Enable lightweight migration
+        /// - Tag: lightweightMigration
+        description.shouldMigrateStoreAutomatically = true
+        description.shouldInferMappingModelAutomatically = true
+
         container.loadPersistentStores { _, error in
             if let error = error as NSError? {
                 fatalError("Unresolved Error \(DebuggingIdentifiers.failed) \(error), \(error.userInfo)")