I have migrated my project to Swift 3 and NSKeyedArchiver
does not work. I actually have a runtime error when trying to decode object like this:
let
Swift 3:
I adopt the double question mark (??) method and it work like a charm in only one line.
If val is not nil than it is unwrapped and the value returned. If it is nil then aDecoder.decodeInteger(forKey: "val")
returned:
self.val = aDecoder.decodeObject(forKey: "val") as? Int ?? aDecoder.decodeInteger(forKey: "val")