소스 검색

enable lightweight migration

polscm32 1 년 전
부모
커밋
c0fa88f364
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  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)")