On 3 Mar 2014, at 9:56 pm, [email protected] wrote:
> It is hard to argue with the statement that you must return self from
> initWithCoder:.
Well, except what is self? It's perfectly legitimate in an init method to write
self = <whatever or nil>. ***that's why you always check if( self ){....} after
calling super in all init methods, including -initWithCoder:.***
Documenting that you must return self means nothing - you always return self
from an init method. What it does not state (and perhaps should) is that unlike
other init methods, self may not be reassigned or set to nil.
> Have you considered using:
>
> - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder
Yes, indeed that's what I am doing. It seems to work and it certainly fixes my
problem.
But if there are some rules which need to be made clearer here (rather than
just my own understanding), then it still might be worth flushing them out so I
can file a bug on the documentation at least.
--Graham
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]