Skip to content

Conversation

@apwelsh
Copy link

@apwelsh apwelsh commented Mar 22, 2017

…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.

…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
Copy link
Author

apwelsh commented Mar 22, 2017

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?

@nicklockwood
Copy link
Owner

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 nicklockwood force-pushed the master branch 2 times, most recently from 577f9ba to e4b098a Compare October 26, 2017 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants