title: How to add new array data to NSDictionary in plist file using Swift
body: <p>I have a plist file ("myAwayList.plist") to store navigation data. I have nested a Dictionary of String variables in an Array in the main Dictionary as follows..</p>
  
  <pre><code>&lt;dict&gt;
  &lt;key&gt;Locations&lt;/key&gt;
  &lt;array&gt;
      &lt;dict&gt;
          &lt;key&gt;Name&lt;/key&gt;
          &lt;string&gt;Sydney City Centre&lt;/string&gt;
          &lt;key&gt;Address&lt;/key&gt;
          &lt;string&gt;Centrepoint Tower&lt;/string&gt;
          &lt;key&gt;Lat&lt;/key&gt;
          &lt;string&gt;-33.870451&lt;/string&gt;
          &lt;key&gt;Lon&lt;/key&gt;
          &lt;string&gt;151.208771&lt;/string&gt;
      &lt;/dict&gt; ...
  </code></pre>
  
  <p>I can successfully load and use the array data inside with the following...</p>
  
  <pre><code>        let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) as NSArray
      let documentsDirectory = paths.objectAtIndex(0)as NSString
      let path = documentsDirectory.stringByAppendingPathComponent("myAwayList.plist")
      let fileManager = NSFileManager.defaultManager()
      // Check if file exists
      if(!fileManager.fileExistsAtPath(path))
      {
          // If it doesn't, copy it from the default file in the Resources folder
          let bundle = NSBundle.mainBundle().pathForResource("myAwayList", ofType: "plist")
          fileManager.copyItemAtPath(bundle!, toPath: path, error:nil)
          println("File did not exist! Default copied...")
      }
      let dict = NSDictionary(contentsOfFile: path)!
      let mySavedLocations: AnyObject = dict.objectForKey("Locations")!
      println("plist all: \(mySavedLocations)")
      if let nsArray:NSArray = mySavedLocations as? NSArray{
          for var loadCount = 0; loadCount &lt; mySavedLocations.count; ++loadCount {
              var locationDict:AnyObject = nsArray[loadCount] // loading array data at index
              let arrayName = locationDict["Name"] as AnyObject? as String
              let arrayAddress = locationDict["Address"] as AnyObject? as String
              let arrayLat = locationDict["Lat"] as AnyObject? as String
              let arrayLon = locationDict["Lon"] as AnyObject? as String
              awaydatalist.append(AwayData(name:arrayName, address:arrayAddress, lat:arrayLat, lon:arrayLon))   // This is a list array used to display the loaded data on a ViewController
          }
      }
  </code></pre>
  
  <p>I now want to append the array inside with another row of data, and write back to the plist file, but I cannot find a way to do it. Please advise?
  Chris</p>