title: Swift: Cannot convert value of type '[String : DayData]' to expected argument type 'AnyObject?'
body: <p>I'm having trouble saving to CoreData when trying to save a new struct I created. </p>
  
  <pre><code>var allInformationByDate = [
  "2016-08-13": DayData(sales: 0, doorsKnocked: 0, milesWalked: 0.00, hoursWorked: 0.00)
  
  ]
  
  struct DayData { 
  let sales: Int
  let doorsKnocked: Int
  let milesWalked: Double
  let hoursWorked: Double
  }
  </code></pre>
  
  <p>I'm getting the error:</p>
  
  <blockquote>
    <p>Cannot convert value of type '[String : DayData]' to expected argument type 'AnyObject?'</p>
  </blockquote>
  
  <p>on this chunk of code, specifically on "allInformationByDate"...</p>
  
  <pre><code>var allInfoByDateDefault = NSUserDefaults.standardUserDefaults()
      allInfoByDateDefault.setValue(allInformationByDate, forKey:"allInfoByDateRecord")
      allInfoByDateDefault.synchronize()
  </code></pre>
  
  <p>Does anybody know how to fix this syntax? I've tried changing to </p>
  
  <pre><code>allInformationByDate as! AnyObject
  </code></pre>
  
  <p>but that just makes the app crash.</p>