Hi All,

I need to extend a class for NSCoding protocol conformance.

I tried the following code in the playground and get an error  - required
initialiser cannot be declared in the extension. If I do not make it
required, I get an error asking to make it required ...and so on

class first : NSObject {
 var name = "string" }

class second : first {
var age:Int
override init() { age = 21 }
}

extension second : NSCoding {
     func encodeWithCoder(aCoder: NSCoder) {
       }
     required convenience init(coder aDecoder: NSCoder) {
      self.init()
       }
}


Any help is appreciated.

Regards,
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to