title: (Swift) Storing and retrieving Array to NSUserDefaults
body: <p>I am trying to store an array to <code>NSUserDefaults</code> and retrieve the array when needed to populate a <code>UITableView</code>.</p>
  
  <p>Currently I am using: </p>
  
  <pre><code>//store data
  NSUserDefaults.standardUserDefaults().setObject(myArray, forKey: "\(identity.text!)listA")                    
  NSUserDefaults.standardUserDefaults().synchronize()
  
  //retrieve data
  let tabledata = NSUserDefaults.standardUserDefaults().stringForKey("\(identity.text!)listA")
  myArray = [tabledata!]
  tableView.reloadData()
  </code></pre>
  
  <p>But I get </p>
  
  <blockquote>
    <p>fatal error: unexpectedly found <code>nil</code> while unwrapping an Optional
    value</p>
  </blockquote>
  
  <p>when trying to load the data. I am not sure if the issue is in the storage or the retrieval. Has anyone been through this before?</p>