Test mainContext fetching directly from PSC. Needs benchmarking esp. with merging

This commit is contained in:
John Estropia
2017-02-09 10:49:50 +09:00
parent 19fea6953a
commit 7ee027f44d
4 changed files with 5 additions and 3 deletions

View File

@@ -99,7 +99,7 @@ internal extension NSManagedObjectContext {
internal static func mainContextForRootContext(_ rootContext: NSManagedObjectContext) -> NSManagedObjectContext {
let context = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
context.parent = rootContext
context.persistentStoreCoordinator = rootContext.persistentStoreCoordinator!
context.mergePolicy = NSRollbackMergePolicy
context.undoManager = nil
context.setupForCoreStoreWithContextName("com.corestore.maincontext")

View File

@@ -73,6 +73,7 @@ public final class DataStack: Equatable {
self.migrationChain = migrationChain
self.rootSavingContext.parentStack = self
self.mainContext.parentStack = self
self.mainContext.isDataStackContext = true
}