Adding the Model Data
For situations in which you need to store relatively small amounts of persistent data — say, less than a few hundred kilobytes — a property list offers a uniform and convenient means of organizing, storing, and accessing the data.
Using property lists
A property list (or plist) is perfect for storing small amounts of data that consist primarily of strings and numbers. What adds to its appeal is the capability to easily read it into your program, use the data, and (although you won’t be doing it in the RoadTrip application) modify the data and then write the property list back out again (see the “Using plists to store data” sidebar, later in this chapter). That’s because iOS provides a small set of objects that have that behavior built right in.
Applications and other system software in OS X and iOS use property lists extensively. For example, the Mac OS X Finder stores file and directory attributes in a property list, and iOS uses them for user defaults. You also get a Property List editor with Xcode, which makes property list files easy to create and maintain in your own programs.
Figure 11-1 shows a property list that I show you how to build — one that contains the data necessary for the RoadTrip app.
After you figure out how to work with property lists, it’s actually easy, but like most things, getting there is half the fun.
Property lists hold serializable objects. A serializable object can convert itself into a stream of bits so that it can be stored ...