I need to extend a class for NSCoding protocol conformance. 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. Initializer requirement 'init(coder:)' can only be satisfied by a required
initializer in the definition of non-final class 'GTLTasksTask'
2. Convenience initializer for 'GTLTasksTask' must delegate (with 'self.init')
SomeClass in this example does not have a designated initialiser, though it's super class has an init method. But as per swift documentation convenience initialisers cannot invoke super.init. I tried making init(coder) a designated initialiser, but that isn't allowed in an extension
Is it not possible to conform this to NSCoding via an extension?