Property List Workshop 1: Before You Begin

If you are a new visitor to our site, please read the Getting Started guide and the tableView workshop series.

This is a three-part series that’ll teach you how create and use Property List file in an iOS application.

What is a Property List?

A property list is an XML file for persisting and restoring small amounts of data. A property list is also known as a plist file because of its unique file extension. You can create a plist file using Objective-C code or Xcode’s Property List template. These images shows what a property list look like in Xcode’s built-in Property List Editor and the XML view of the plist file.

A plist file in Xcode’s Property List Editor XML view of the plist file in Xcode’s Property List Editor

Here are three not to be forgotten things you should know about a property list file.

  1. Property list file is only used for storing objects of these data types: NSDictionary, NSArray, NSNumber, NSString, NSDate, BOOL, NSData.
  2. You can only perform reading and writing operations in a plist file. Reading operation involves loading the entire content of the plist file into an NSDictionary object or an NSArray object. Writing operation involves writing the entire content of an NSDictionary object or an NSArray object in the plist file.
  3. Memory on an iOS device is limited; therefore, you should not perform reading and writing operation involving large amount of data.

Overview of The Property List Application

The iOS application you will develop in this workshop is called PropertyListDemo. It will consist of a single view and here are images of what it will look like in the iPhone Simulator.

plistdemo-fig00

iOS App Tasks

We will add code in the application class files to perform these tasks.

  • Create a property list file in the application sandbox’s Documents directory
  • Add twelve glossary (programming words and definitions) in the plist file
  • Retrieve all glossary entries from the plist file and place them in a dictionary variable
  • Set the textView control’s text attribute with instructions shown in Figure 1 above
  • Get the dictionary’s keys and put them in the tableView control’s rows-see Figure 1 above
  • Get the dictionary entry that match the table row the user tapped, and put it in the textView control-see Figure 2 above

User Tasks

The application shall allow the user to perform these tasks.

  • View a list of twelve programming words-see Figure 1 above
  • Tap a row of the tableView control to see that row’s word and definition in the textView control-see Figure 2 above.

Download The Xcode Project

I’ve already created the Xcode project you will develop in the Property List Workshop series, so just click the link shown below to download it.

After unzipping the file, drag and drop the PropertyListDemo folder in the iOS Apps folder.
plistdemo-fig03
That’s pretty much it for this week’s workshop. Next week you will get started on developing the application. Until then, happy coding! 🙂