Threading and Core Data

Throughout the life of the Core Data framework, the approach to using Core Data with threading has changed many times. Originally there was no support for threading other than “figure it out,” which evolved into the basic rule of “A context and its data must stay on one thread.”

With the introduction of iOS 5.0 and OS X 10.8, Core Data began utilizing GCD (Grand Central Dispatch) and blocks that were introduced to the overall system in the previous generation. To further define how threading should be approached with Core Data, the threading model was again refined in iOS 8.0 and OS X 10.10 and yet again in iOS 9.0 and OS X 10.11.

With these changes, the threading model for Core Data has become a binary decision. We can ...

Get Core Data in Swift 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.