Re: +(NSSet *)keyPathsForValuesAffectingValueForKey:
Re: +(NSSet *)keyPathsForValuesAffectingValueForKey:
- Subject: Re: +(NSSet *)keyPathsForValuesAffectingValueForKey:
- From: "Ashley Clark" <email@hidden>
- Date: Tue, 14 Oct 2008 00:04:00 -0500 (CDT)
- Importance: Normal
> Does anyone know if you can use this mechanism for dotted values, or does
> it have to be a value local to the object?
>
> For example, could you say that field "a" depends on "b.c"? I'm trying to
> do that but it doesn't seem to work or me.
Yes, you can. I'm doing it in at least one of my classes like so:
+ (NSSet *)keyPathsForValuesAffectingActualUnitPrice {
return [NSSet setWithObjects:@"unitPrice", @"transaction.unitPrice",
nil];
}
And the transaction property itself also has a dependency:
+ (NSSet *)keyPathsForValuesAffectingTransaction {
return [NSSet setWithObject:@"transactions"];
}
It all works perfectly here. What errors (if any) are you seeing? Make
sure that all of your data access to those dependent properties are
enclosed in willChange.../didChange... methods.
--
Ashley Clark
_______________________________________________
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