Alternative to Realm Data. It is iOS native library.

Whole flow summary

In Core Data, we first create an NSPersistentContainer, which loads our .xcdatamodeld file. We usually access it through a shared singleton PersistenceController. From the container, we get an NSManagedObjectContext, which acts as the working area for Core Data operations. We then use that context to create or fetch managed objects generated from our .xcdatamodeld entities, such as User or TodoItem. After accessing or modifying the object's properties, Core Data automatically tracks those changes, and when we call context.save(), the changes are persisted to the underlying store.


Core Data – Interview Mastery Outline

  1. What is Core Data?
  2. What is .xcdatamodeld?
  3. What is NSPersistentContainer?
  4. What is NSManagedObjectContext?
  5. What is an NSManagedObject?
  6. How Object Creation and Saving Works
  7. Optional vs Non-Optional Attributes (And Why It Matters)
  8. Code Generation Options in Core Data
  9. Fetching Data
  10. Relationships
  11. How Core Data Actually Persists Data (Under the Hood)
  12. The Role of AppDelegate (or Dependency Injection)
  13. objectID vs Custom id
  14. When to Use Separate Domain Models
  15. Common Beginner Mistakes