Class Extension for NSCoding Protocol Compliance

I need to extend the class to match the NSCoding protocol. This is what I tried:

extension GTLTasksTask : NSCoding {

    public func encodeWithCoder(aCoder: NSCoder) {

    }

    public convenience init(coder aDecoder: NSCoder) {

    }

}

But I get two errors: 1. The initializer requirement "init (coder :)" can only be satisfied by the initializer requiredin the definition of the non-final class "GTLTasksTask" 2. The convenience initializer for the "GTLTasksTask" should delegate (with "self.init")

SomeClass in this example does not have a designated initializer, although the superclass has an init method. But according to the quick documentation, convenience of initializers cannot call super.init. I tried to make init (coder) the designated initializer, but this is not allowed in the extension

Is it impossible to match NSCoding through the extension?

+4
1

Require. xCode 6.0 ( )

extension GLTasksTask : NSCoding {

    public func encodeWithCoder(aCoder: NSCoder) {

    }

    public required convenience init(coder aDecoder: NSCoder) {

    }
}
-4

All Articles