Parent-Child Contexts
You learned in Chapter 21 that an instance of NSManagedObjectContext is associated with a specific queue, which is the main queue in the case of the mainQueueContext. A single context associated with the main queue is the minimum that you need for a working Core Data application, but any Core Data operations that take a long time will noticeably block the main queue, resulting in an unresponsive application.
To address this problem, applications using Core Data often have multiple contexts. Photorama will have one context associated with the main queue and another context associated with a background queue.
Open CoreDataStack.swift. Add another context that is associated with a private, or background, queue. ...
Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.