Property Lists

Dok-tips for the thing called "Property List"

Characteristics

A Property List is not an Objective-C structure, or a class, its simply a term that refers to a qualified collection of collections - an object graph (with certain limitations) which is implemented as XML text

Basically an NSDictionary type thing (even if the top item is an array - because it uses XML key-value pairs for everything in it

Property lists are SLOW and inefficient. So, only use them for data that is rarely accessed or changed and keep them relatively small (less than 1000 items?)

Best (safest) if created and edited from within XCode

Valid components are limited to the following classes and their subclasses:

  • NSString, NSMutableString
  • NSArray, NSMutableArray
  • NSDictionary, NSMutableDictionary
  • NSNumber
  • NSDate
  • NSData

An instance of NSArray, or NSDictionary is a "property list" if all of its members are also - too its full depth of contained items (arrays of arrays etc.).

NSDictionary instance is a property list if all of its keys are also valid property list objects

Used by NSArray and NSDictionary when calling

- (void)writeToFile:(NSString *)path atomically:(BOOL)atom;

Property list is the basis of NSUserDefault

Examples

Text dump of a sample property list

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>CFBundleDevelopmentRegion</key>
  <string>en</string>
  <key>LSRequiresIPhoneOS</key>
  <true/>
  <key>UIMainStoryboardFile</key>
  <string>MainStoryboard_iPhone</string>
  <key>UIRequiredDeviceCapabilities</key>
  <array>
    <string>armv7</string>
  </array>
  <key>UISupportedInterfaceOrientations</key>
  <array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
  </array>
</dict>
</plist>


List of all Foundation Structure etc.