title: Setting Up an image in swift using NSuserdefaults
body: <p>I'm building a swift game and a need to set up some images.
  My code works with string or integer:</p>
  <pre><code>for var i = 0; i &lt; globalCurrentMembers.count; ++i {
      var MembersDefaultName = NSUserDefaults.standardUserDefaults()
      MembersDefaultName.setValue(globalCurrentMembers[i].name, forKey: &quot;globalCurrentMembersName\(i)&quot;)
      MembersDefaultName.synchronize()
  }
  </code></pre>
  <p>But I have an error for an image</p>
  <pre><code>for var i = 0; i &lt; globalCurrentMembers.count; ++i {
      var MembersDefaultImage = NSUserDefaults.standardUserDefaults()
      MembersDefaultImage.setValue(globalCurrentMembers[i].image, 
                          forKey: &quot;globalCurrentMembersImage\(i)&quot;)
      MembersDefaultImage.synchronize()
  }
  </code></pre>
  <p><code>globalCurrentMembers</code> is an array of <code>Member</code> which looks like that:</p>
  <pre><code>class Member {
     var image = UIImage ()
     var name = String ()
     var progression = Int()
     var round = Int()
     var level = Int()
     var imageProgression = [UIButton]()
  
  
     func Init(){
        image = UIImage(named: &quot;default.png&quot;)!
        name = &quot;default&quot;
        progression = 0
        round = 0
        level = 0
     }
  }
  </code></pre>
  <p>So please can you tell me how doing that.</p>