polscm32 2 gadi atpakaļ
vecāks
revīzija
2561c5b489
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  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