• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Extension to class for NSCoding protocol conformance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extension to class for NSCoding protocol conformance


  • Subject: Extension to class for NSCoding protocol conformance
  • From: Jaikanth CK <email@hidden>
  • Date: Sat, 25 Oct 2014 20:45:52 +0530

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Extension to class for NSCoding protocol conformance
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Any way to avoid external parameter names?
  • Next by Date: Re: Extension to class for NSCoding protocol conformance
  • Previous by thread: Re: Any way to avoid external parameter names?
  • Next by thread: Re: Extension to class for NSCoding protocol conformance
  • Index(es):
    • Date
    • Thread