title: how to save and read array of array in NSUserdefaults in swift?
body: <p>I need create an array to add objects with this format like a dictionary in Swift : ["key1": "value1", "key2": "value2"]</p>
  
  <p>When I try to save it with <code>NSUserDefaults</code> all is correct, but when read <code>NSUserDefaults</code> with the key this crashes. What type of data does my var obj need?</p>
  
  <pre><code>let def = NSUserDefaults.standardUserDefaults()
  var key = "keySave"
  var element: AnyObject!
  
  var array1: [AnyObject!] = []
  array1.append(["key1": "val1", "key2": "val2"])
  array1.append(["key1": "val1", "key2": "val2"])
  
  //save
  var savestring : [AnyObject!]
  savestring = array1
  var defaults = NSUserDefaults.standardUserDefaults()
  defaults.setObject(savestring, forKey: key)
  defaults.synchronize()
  
  //read
  var obj: [AnyObject!] = []
  if(obj != nil){
      print("size: ")
      print(obj.count) //vary long value confused..
      element = obj[0]  //crash
      print(element.objectForKey("key1"))
  }
  </code></pre>