Catch Objective-C exception in Swift

前端 未结 4 1544
日久生厌
日久生厌 2021-02-07 10:56

I am trying to set the value of an @objc object in my Swift code using obj.setValue(value, forKey: key).

It works fine when the object has the

4条回答
  •  既然无缘
    2021-02-07 11:54

    I wanted to call out the answer given in this question:

    Catching NSException in Swift

    as you can still use the Swift do/catch with the call in a natural fashion, the next best thing to Swift actually catching ObjC exceptions as it should.

提交回复
热议问题