get rid of warning with core data

This commit is contained in:
Trey t
2022-01-26 13:46:17 -06:00
parent 8c58b37be5
commit 25843185f9

View File

@@ -198,19 +198,14 @@ class PersistenceController {
container = NSPersistentContainer(name: "Feels") container = NSPersistentContainer(name: "Feels")
} }
guard let description = container.persistentStoreDescriptions.first else {
fatalError("Could not retrieve a persistent store description.")
}
description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
container.viewContext.automaticallyMergesChangesFromParent = true
for description in container.persistentStoreDescriptions { for description in container.persistentStoreDescriptions {
description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
} }
container.loadPersistentStores(completionHandler: { (storeDescription, error) in container.loadPersistentStores(completionHandler: { (storeDescription, error) in
self.container.viewContext.automaticallyMergesChangesFromParent = true
if let error = error as NSError? { if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)") fatalError("Unresolved error \(error), \(error.userInfo)")
} }