In Swift, NSKeyedUnarchiver.unarchiveObjectWithData(data)
will throw an exception if data can't be unarchived.
There are some situations where we have no guarantee if that the data is not corrupted, such as when reading from a file.
I am not aware of a try/catch mechanism in Swift, nor that I know of a method like canUnarchive
that would help prevent the exception.
Besides implementing the try/catch in Obj-C, is there a pure Swift solution to this problem?