Change background CoreData context to be a child of the main context so
that updates on the background context propogate up to the view context on save
This commit is contained in:
parent
35a510e8ed
commit
d396eb0823
|
@ -18,7 +18,11 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
return NSManagedObjectModel(contentsOf: url)!
|
return NSManagedObjectModel(contentsOf: url)!
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private(set) lazy var backgroundContext = newBackgroundContext()
|
private(set) lazy var backgroundContext: NSManagedObjectContext = {
|
||||||
|
let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
|
||||||
|
context.parent = self.viewContext
|
||||||
|
return context
|
||||||
|
}()
|
||||||
|
|
||||||
let statusSubject = PassthroughSubject<String, Never>()
|
let statusSubject = PassthroughSubject<String, Never>()
|
||||||
let accountSubject = PassthroughSubject<String, Never>()
|
let accountSubject = PassthroughSubject<String, Never>()
|
||||||
|
|
Loading…
Reference in New Issue