title: cast NSString! to String in swift
body: <p>I have a instance variable name in String</p>
  
  <pre><code>var name: String
  </code></pre>
  
  <p>My class implements the NSCoding protocol. So for name I had</p>
  
  <pre><code>func encodeWithCoder(aCoder: NSCoder) {
      aCoder.encodeObject(self.name, forKey: kName)
  }
  
  required init(coder aDecoder: NSCoder) {
      self.name = aDecoder.decodeObjectForKey(kName) as String  // CRASH HERE
  }
  </code></pre>
  
  <p>Result? I was getting a run time crash during initiation with decoder. I changed init to this:</p>
  
  <pre><code>var temp = aDecoder.decodeObjectForKey(kName) as NSString!
  self.name = aDecoder.decodeObjectForKey(kName) as String
  </code></pre>
  
  <p>and realised the value temp is holding the right NSString value. so I thought the line below is going to fix it but it issues a linker error:</p>
  
  <pre><code>self.name = aDecoder.decodeObjectForKey(kName) as NSString!
  </code></pre>
  
  <p>the questions is how to take the temp and put it into name?</p>