Catch Objective-C exception in Swift
<p>I am trying to set the value of an <code>@objc</code> object in my Swift code using <code>obj.setValue(value, forKey: key)</code>.</p>

<p>It works fine when the object has the property being set. But if it doesn't, my app crashes hard with an uncaught <code>NSException</code> ("class is not key value coding-compliant…").</p>

<p>How can I catch and absorb this exception like I can in Objective-C so as to not crash my app? I tried wrapping it in a Swift try-catch, but it complains that none of the instructions throws and does nothing.</p>