title: How to share data with containing app using NSUserDefaults ? - Today Extension Widget
body: <p>I am trying to create a <em>Today Extension Widget</em> which displays stored data in the widget. </p>
  
  <p>Here's what I have done;</p>
  
  <ul>
  <li>Added New Today Widget Target</li>
  <li>Set up UIViewController for widget</li>
  <li>Enable App Groups for both the app and extension </li>
  </ul>
  
  <p>Now I have hit a road block, I am unsure the best way to retrieve and display a simple array of fetched data. </p>
  
  <p>There is very little Swift tutorials and they often do not use core data. </p>
  
  <p>In the main app project I fetch the array.</p>
  
  <pre><code> let moc = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext
   let request = NSFetchRequest(entityName: "Objects")
      do {
        try
        self.objectsArray = moc.executeFetchRequest(request) as! [Objects]
      } catch {
  
      }
  </code></pre>
  
  <p>How can I use <code>NSUserDefaults</code> to store the objects array and then use in the today widget extension ? Or Even an array of string values. </p>