Re: Receiver type for instance message is a forward declaration
Re: Receiver type for instance message is a forward declaration
- Subject: Re: Receiver type for instance message is a forward declaration
- From: Quincey Morris <email@hidden>
- Date: Tue, 10 May 2016 16:13:52 -0700
- Feedback-id: 167118m:167118agrif8a:167118sbz7l15ghZ:SMTPCORP
On May 10, 2016, at 16:05 , Carl Hoefs <email@hidden> 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@hidden)
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:
This email sent to email@hidden