SecureCoding with Subclasses and CoreData ni swift

192 Views Asked by At

I wanted to implement diferrent possible values within a CoreData field as Transformable and subclasses. Swift doesn't seem to like my implementation: (the superclass)

public class ResponseItemValueDTODB: NSObject, NSSecureCoding {
  public static let supportsSecureCoding: Bool = true
  ...
}

The subclasss:

class ResponseItemValueTextDTODB: ResponseItemValueDTODB {
  //public static var supportsSecureCoding: Bool  = true
  ...
}

Now the error: Class 'xx.ResponseItemValueTextDTODB' has a superclass that supports secure coding, but 'xx.ResponseItemValueTextDTODB' overrides -initWithCoder: and does not override +supportsSecureCoding. The class must implement +supportsSecureCoding and return YES to verify that its implementation of -initWithCoder: is secure coding compliant.

If i uncomment the line in the subclass, the swift compiler doesn't like it too, with error: Cannot override with a stored property 'supportsSecureCoding' on that line

How should i go about making the NSSecureCoding happy?

0

There are 0 best solutions below