> On 6 Feb 2015, at 17:34, Kyle Sluder <k...@ksluder.com> wrote:
> 
> Dealloc is too late for a lot of this stuff. I try to keep -dealloc as
> pure as possible; that is, -dealloc should only be concerned with memory
> management.
> 
I agree that dealloc is far from perfect. What it does have going for it is 
ubiquity and reliability.
In also implement a -dispose method that I trigger from -windowWIllClose.
This cascades down the view controller hierarchy but needs a bit of glue of 
course.

> Removing observers, unbinding, unregistering notifications, and timer
> invalidation all happens in -viewWillMoveToWindow: or another similar
> place.

-viewWillMoveToWindow: can called a lot if a view is repeatedly added and 
removed from the window view hierarchy.
It would also need hooked up to the view controller to be actually useful.
To be honest the “other place” doesn’t generically exist in my experience.
Hence -dealloc and -dispose.

Jonathan
_______________________________________________

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