polscm32 2 лет назад
Родитель
Сommit
2561c5b489
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      Model/CoreDataStack.swift

+ 3 - 0
Model/CoreDataStack.swift

@@ -74,6 +74,9 @@ class CoreDataStack: ObservableObject {
         // Create a private queue context
         /// - Tag: newBackgroundContext
         let taskContext = persistentContainer.newBackgroundContext()
+
+        /// ensure that the background contexts stay in sync with the main context
+        taskContext.automaticallyMergesChangesFromParent = true
         taskContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
         taskContext.undoManager = nil
         return taskContext