I am currently trying the iOS 10 Beta and decided to convert my Swift code to Swift 3. Until now, I was able to securely decode a String using
coder.decodeObjectOfClass(NSString.self, forKey: CoderKeys.code) as! String
After the conversion to Swift 3, Xcode is giving me the following error:
'decodeObjectOfClass(_:forKey:)' is unavailable in Swift: use generic 'decodeObjectClass(_:forKey:)'
As I mentioned, I'm using NSSecureCoding, so unfortunately decodeObject(forKey: String)
won't do. Is this a beta bug? What am I missing?
It seems decodeObjectOfClass:forKey:
is imported as generic decodeObject(of:forKey:)
in Swift 3.
Try this:
coder.decodeObject(of: NSString.self, forKey: CoderKeys.code) as String?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With