On May 10, 2016, at 16:05 , Carl Hoefs <[email protected]> wrote:
> 
> I'm not sure how context is to be used here

It has to be a value that’s unique to the piece of code that tests it. In 
effect, this means unique to the class that creates and responds to the 
observations. If you’re in Obj-C, the usual trick is to use the static address 
of something, like this:

> static void* kvoContext = &kvoContext;

This exploits a quirk of C to initialize the static variable as containing its 
own address. That means you can specify the ‘context:’ parameter as EITHER 
‘kvoContext’ OR ‘&kvoContext’, so that forgetting the & is harmless.


_______________________________________________

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]

Reply via email to