O'Reilly logo

Beginning, Mac OS® X Snow Leopard™ Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Core Data-Based Cocoa Applications

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required