> On 6 Feb 2015, at 17:34, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Feb 6, 2015, at 6:48 AM, Jonathan Mitchell <jonat...@mugginsoft.com> 
>> wrote:
>> 
>>      // remove observers
>>      // unregister for notifications
> 
> I have to confess I'm still not completely certain whether these are needed 
> under ARC. I remember reading something about at least one of these being 
> handled automatically, but I just skimmed through some docs now and couldn't 
> find anything. I tend to put these in my classes but always wonder whether I 
> strictly need to.

I was just checking whether I needed to manually unbind any bindings that I 
make manually.
Looks like I don’t, according to the fragment below from the 
NSKeyValueBinding.header.
Binding obviously involves observation and the header note makes it explicit 
that removing observers is recommended.
I think the one exception is self observation.
I think under GC observers may have been removed automatically - cannot quite 
recall.

Header note:

Bindings are considered to be a property of the object which is bound (the 
object the following two methods are sent to) and all information related to 
bindings should be retained by the object; all standard bindings on AppKit 
objects (views, cells, table columns, controllers) unbind their bindings 
automatically when they are released, but if you create key-value bindings for 
other kind of objects, you need to make sure that you remove those bindings 
when you release them (observed objects don't retain their observers, so 
controllers/model objects might continue referencing and messaging the objects 
that was bound to them).

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