Here, I will save basic coredata information for anyone/me would like a quick refresh for these fundamentals from time to time.
- Core Data is not a database, but instead it manages an Object Graph.
-
NSManagedObject
andNSManagedObjectContext
in Core Data are not thread-safe. -
Core Data avoids data race issues by operating on
NSManagedObject
instances andNSManagedObjectContext
instances in a serial queue.
This is why we need to place the operation code within the closures of perform or performAndWait. -
Developers should perform operations on the main thread queue for the view context and the managed object instances registered within it. Similarly, we should perform operations on the serial queue created by the private context for private contexts and the managed objects registered within them.
- Enable Core Data Concurrency Debugging Parameters
To void issues like .......... to be continued
ModelContext
of SwiftUI is like a wrapped version ofNSManagedObjectContext
References:
-
Core Data Fundamentals - Exploring the Core Data Stack
https://cocoacasts.com/exploring-the-core-data-stack -
Concurrent Programming in SwiftData https://betterprogramming.pub/concurrent-programming-in-swiftdata-c9bf021a4c2d
Data Model
It is represented by a file in the application bundle.
It contains the data schema of the application.
It is nothing more than a collection of entities.

An entity have a collection of attributes, and relationships.