0% found this document useful (0 votes)
38 views10 pages

Core Data and Magical Records

Core Data is an object graph and persistence framework that allows storing and managing objects and object relationships. It includes components for object graph management, persistence to a data store, and a persistent store coordinator. Core Data operations should be done off the main thread for concurrency. MagicalRecords makes working with Core Data easier by handling common tasks like fetching objects across threads.

Uploaded by

akshaynhegde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views10 pages

Core Data and Magical Records

Core Data is an object graph and persistence framework that allows storing and managing objects and object relationships. It includes components for object graph management, persistence to a data store, and a persistent store coordinator. Core Data operations should be done off the main thread for concurrency. MagicalRecords makes working with Core Data easier by handling common tasks like fetching objects across threads.

Uploaded by

akshaynhegde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Core Data and Magical

Records

Whats the plan?


Understand what is Core Data and its
components.
How to move Core Data operations away
from main thread.
How can MagicalRecords can make your life
easier.

So, What is it?

Its is a Model Layer technology


Its is a persistance technology
It does Object Graph management
Its NOT a SQL wrapper
Its independent of any UI level frameworks

Components
Object Graph Management
Persistance
Persistant Store Coordinator (PSC)
When these components are tied together..

The Stack

Concurrency
Core Data isn't thread safe or is it?
NSManagedObject
Do not pass the instance from one thread to another
Use objectID

NSManagedObjectContext
Context belongs to the thread it was created on
(NSConfinementConcurrencyType)

Make use of parent-child relations


NSPrivateQueueConcurrencyType
performBlock: and performBlockAndWait: are
executed in a background thread

NSMainQueueConcurrencyType
performBlock: and performBlockAndWait: are
executed in the main thread

MagicalRecords
https://github.
com/magicalpanda/MagicalRecord

Reference

Apple Docs
Core Data Overview - objc.io
Multi Context Core Data - Cocoanetics
My Core Data Stack - Marcus Zarra
Core Data from scratch - Concurrenncy
Core Data Concurrency - CodeCentric
Common Background Practices - Objc.io
NSManagedObjectContext - Docs

You might also like