Fetching is the term used to describe the resolving of NSManagedObject objects from the repository. When we retrieve an NSManagedObject, it’s “fetched” into memory, and we can then access its properties. To help us utilize memory efficiently, fetching may not always happen all at once. Specifically, when we’re using a SQLite store, it’s quite possible that an object we think is in memory is only on disk and has yet to be read into memory. Likewise, objects that we think we’re done with may actually still sit in a cache.

To demonstrate the differences in the ways that we can load data into memory from our SQLite Store, I ran a number of tests using one of Apple’s older demonstration application from a previous Worldwide Developer Conference ...

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.