title: How to save struct to NSUserDefaults in Swift 2.0
body: <p>I have a struct named <code>Jar</code>and I would like to save an array of them to NSUserDefaults.  Here is the jar struct code:</p>
  
  <pre><code>struct Jar {
  
      let name: String
      let amount: Int
  
      init(name: String, amount: Int){
          self.name = name
          self.amount = amount
      }
  }
  </code></pre>
  
  <p>I belive that I will need to convert this to an NSObject to be able to save it.  (Because you can't save a struct directly to NSUserDefaults). My questions are:
  <strong>How do I convert an array of structs to an NSObject?</strong> and <strong>How to convert an NSObject back at an array of structs.</strong></p>