Chapter 11. Persistence and object management with Core Data

 

This chapter covers

  • Introduction to Core Data
  • Differences between Core Data and traditional databases
  • Creating your Core Data model with relationships
  • Creating, updating, deleting, and fetching managed objects
  • Using a fetched results controller with a table view
  • Creating a Core Data–backed task list management app

None of the apps that we’ve created together so far have used any type of local persistence. The implication of this is that the data you store in your apps will never be saved. If you quit an app and relaunch it, it won’t be able to retrieve anything that you’ve created. Depending on the type of application you’re building, you could store and fetch this data remotely on some server. The problem with this would be making your users wait while you make a long request to retrieve their data. Also, if they didn’t have an internet connection, you wouldn’t be able to retrieve it for them.

Thankfully, Apple has provided us with the Core Data framework. Core Data can help us by allowing us to do object management and persistence within our apps. It’s such a big and powerful framework that entire books have been written on Core Data alone. We’ll cover many of the important parts—the parts that will allow you to write your own Core Data–backed application by the end of the chapter.

11.1. Introduction to Core Data

11.2. Managed objects, entities, relationships

11.3. Working with managed objects

11.4. Summary