Created
March 4, 2020 17:19
-
-
Save rahul-inspired-iosdeveloper/83f5ac5aa45be4d4d74fdd2e4c9c1657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let privateMOC = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) | |
privateMOC.parent = context | |
privateMOC.performAndWait { | |
//do some coredata stuff, but dont carry on beyond this block, until the code | |
//in this block has finished executed (sync, not async) | |
saveContext(forContext: privateMOC) | |
} | |
//now save the main context with the changes from the private context | |
saveContext(forContext: context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment