Hi all,
If I implement a custom setter for an NSManagedObject attribute, what
can/can't I do?
For example, can I do nothing if the old and new values are the same?
- (void)setSalary:(NSNumber*)newsalary
{
get current salary
compare with newsalary
if different
[self willChangeValueForKey:@"salary"];
[self setPrimitiveValue:newsalary forKey:@"salary"];
[self didChangeValueForKey:@"salary"];
}
Or is it required to _always_ call willChange/setPrimitive/didChange?
Most of the time I use CD's dynamically generated accessors, but
occasionally I implement custom ones. I couldn't find a general
discussion of what can and can't be done safely in much methods.
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng [email protected]
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]