title: NSKeyedUnarchiver error handling - prevent crash in Swift
body: <p>Since Swift currently doesn't have try-catch, how am I supposed to prevent crashes with bad data in this line of code?</p>
  
  <pre><code>var myObject = NSKeyedUnarchiver.unarchiveObjectWithData(data) as MyClass
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I created a very simple case in a playground for demonstration. Assume we don't know what's in <code>data</code>, how can I catch the SIGABRT on the second line? Is there no way to check to make sure it is possible to unarchive an NSData object before calling <code>unarchiveObjectWithData</code>?</p>
  
  <pre><code>var data = "foo bar".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!
  if let unarc = NSKeyedUnarchiver.unarchiveObjectWithData(data) { // Execution was interrupted: signal SIGABRT
  }
  </code></pre>