• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Correct way to overide synthesized setter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct way to overide synthesized setter?


  • Subject: Re: Correct way to overide synthesized setter?
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 28 Feb 2010 12:19:07 -0600

On Feb 28, 2010, at 11:45 AM, Chris Tracewell wrote:

> On Feb 28, 2010, at 9:26 AM, Jens Alfke wrote:
>
>> On Feb 28, 2010, at 8:23 AM, Chris Tracewell wrote:
>>
>>> I have two synthesized properties - A and B. Whenever A changes I need B to be updated to A.keypath.
>>
>> If B's value is entirely dependent upon A, you don't even need to synthesize it — you can just implement B's getter to return A.keypath, and declare B as dependent on A:
>>
>> - (NSString*) b {return A.keypath; }
>> + (NSArray*) keyPathsForValuesAffectingB { return [NSArray arrayWithObject: @"a"]; }
>
> keyPathsForValuesAffecting looks like what I am looking for.

Except note that it should return an NSSet, not an NSArray.

+ (NSSet*) keyPathsForValuesAffectingB { return [NSSet setWithObject:@"a"]; }

Regards,
Ken

_______________________________________________

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

References: 
 >Correct way to overide synthesized setter? (From: Chris Tracewell <email@hidden>)
 >Re: Correct way to overide synthesized setter? (From: Jens Alfke <email@hidden>)
 >Re: Correct way to overide synthesized setter? (From: Chris Tracewell <email@hidden>)

  • Prev by Date: Re: Embedding Custom NSView in NSScroller having strange effect on drawRect calls.
  • Next by Date: Re: Connecting Outlet on Derived Array Controller
  • Previous by thread: Re: Correct way to overide synthesized setter?
  • Next by thread: Re: Correct way to overide synthesized setter?
  • Index(es):
    • Date
    • Thread