Unless your application is a trivial one, it will need at some point to work with data. This data could be as simple as a list of high scores that the user has achieved, or as complex as a multimedia document like a presentation.
This information needs to be accessible to other parts of your application, such as the controller objects, so that work can be done on it. The information needs to be stored somewhere—either in memory, on disk, or on the network.
OS X and iOS provide tools for storing information on disk and on the network. One of the more recent additions to the APIs available to developers is iCloud, a network-based storage system that is designed to allow users to keep the same information on all their devices, without having to do any work to enable this.
Additionally, Cocoa is designed to make the connection between the model, the view and the controller as flexible as possible, while at the same time reducing the amount of code that you need to write. To this end, Cocoa uses features called key-value coding, which allows you to refer to properties of objects by name rather than by hardcoding method calls, and key-value observing, which allows you to have an object be notified when another object changes the value of one of its properties.
In this chapter, you will learn how key-value coding and key-value observing work, why they’re useful, and how to use them in your code. You will also learn how to work with the filesystem to ...