Chapter 10. Core Data-Based Cocoa Applications


  • How to design a document data model in an object graph

  • How to observe, change, and sort Core Data objects using Cocoa Bindings

  • How to create your own Core Data objects and insert them into a managed object context

  • How to manually set and get values from Core Data objects

  • How Core Data and Cocoa Bindings interact with other Cocoa archiving technologies

In the last chapter you learned a few things about document-based applications. In the examples and exercises you dealt with simple documents, text files and images, and how to focus on user interface and dataflow issues. Applications often want to store their own data, in a format specific to that application. What do you do if a file format doesn't exist that Cocoa knows about? You make one.

There are many ways to deal with your own document format. And Cocoa itself has made many attempts at solving this problem over the years. The property list format you saw in Chapter 5 is one example. Many Cocoa programs use property lists to store their own document data, because they are easily understood, many tools exist for working with them, and with a little effort they can store any kind of Objective-C object. Recently, Core Data has emerged as a preferred way of solving this problem among many Cocoa programmers.

Core Data provides a way to store collections of Objective-C objects in a database. When talking about a document-based application, you can think of ...

Get Beginning, Mac OS® X Snow Leopard™ Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.