O'Reilly logo

Core Data in Swift by Marcus S. Zarra

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

Working off the Main Queue

Now that threading with Core Data has been reduced to a binary question, the other type of NSManagedObjectContext we will take a look at is the NSPrivateQueueConcurrencyType.

The singular difference between the two context types is what queue the context is associated with. When you’re working with an NSMainQueueConcurrencyType context, the context automatically associates itself with the main queue. When you initialize an NSPrivateQueueConcurrencyType context, the context will associate itself with a non-main queue that’s private to the context.

Private means that you cannot access that queue directly. Calling dispatch_sync or dispatch_async on that queue is against the API. So, the only way to interact with a private ...

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