AutoCoding icon indicating copy to clipboard operation
AutoCoding copied to clipboard

Updated initWithCoder to correct implementation with proper initializ…

Open apwelsh opened this issue 7 years ago • 2 comments

…er method

The initWithCoder method is missing a call to [self init], so I modified the initWithCoder function to adhere to the standard initializer template.

apwelsh avatar Mar 22 '17 05:03 apwelsh

I just saw the change log notation that the initWithCoder method no longer calls the init method. Ignore my pull request. But please explain why this was done?

apwelsh avatar Mar 22 '17 05:03 apwelsh

It's tricky. initWithCoder is not supposed to call [self init] because then you'd probably be setting all the properties twice.

Ideally it would call [super init] or [super initWithCoder:], but that's not possible here since it's implemented as a category on NSObject, which has no superclass.

nicklockwood avatar Mar 22 '17 09:03 nicklockwood