O'Reilly logo

iOS Programming: The Big Nerd Ranch Guide by Aaron Hillegass, Christian Keur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required