Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What to use observeValueForKeyPath: context



On Aug 29, 2008, at 12:43 PM, Keith Duncan wrote:

After all, what prevents somebody else from using 1091 too?

Nothing whatsoever. But that isn't a problem. So long as the observation context remains internal it doesn't have to be universally unique.

It has to be unique within an inheritance hierarchy.

The context is the only thing you use to determine if an - observeValueForKeyPath:... was meant for you, or for one of your superclasses.

If you use a magic number, you have no guarantee that a superclass didn't also use the same magic number. Solution: don't use magic numbers.

Jim

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >What to use observeValueForKeyPath: context (From: Dave Dribin <email@hidden>)
 >Re: What to use observeValueForKeyPath: context (From: "Michael Ash" <email@hidden>)
 >Re: What to use observeValueForKeyPath: context (From: Keith Duncan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.