Explorar el Código

enable lightweight migration

polscm32 hace 2 años
padre
commit
c0fa88f364
Se han modificado 1 ficheros con 5 adiciones y 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)")