Chapter 7. Implementing persistence with Core Data

 

This chapter covers

  • Learning Core Data basics
  • Using the NSManagedObject and NSManagedObjectContext classes
  • Creating a MacRuby application that uses Core Data

When you create your own MacRuby applications, take into account that almost every application persists some amount of information. When your application depends on user-created content it’s important that this information be available each time the application is used.

In chapter 3 you created a Todo List application that stores individual tasks in memory. When you relaunch the application, none of the previously created items appear. Core Data provides a way to persist this data. In this chapter we’ll investigate Core Data and you’ll also create a new version of the Todo List application to remedy the lost-data issue.

7.1. Introducing Core Data

Core Data is a framework that you can use with Cocoa in your MacRuby applications. In this section you’ll get a brief introduction to Core Data, learn why you’d want to use it, and get insight into what makes it different from other data storage solutions. You’ll also see how Xcode makes it simple to work with Core Data.

7.1.1. Core Data concepts

7.2. Understanding the persistent store and managed objects

7.3. Working with managed objects

7.4. Retrieving objects from Core Data

7.5. Creating a Core Data version of the Todo List application

7.6. Summary