Apple guys: is the XCode generated CD accessor code decent?
Apple guys: is the XCode generated CD accessor code decent?
- Subject: Apple guys: is the XCode generated CD accessor code decent?
- From: Scott Ellsworth <email@hidden>
- Date: Fri, 27 May 2005 11:20:57 -0700
Hi, all.
In the context menu item for a Core Data attribute, you will find
'copy method implementations to clipboard".
For my int16 attribute atm, it produces
- (short)atm
{
NSNumber *tmpValue;
[self willAccessValueForKey: @"atm"];
tmpValue = [self primitiveValueForKey: @"atm"];
[self didAccessValueForKey: @"atm"];
return (tmpValue!=nil) ? [tmpValue shortValue] : 0;
}
- (void)setAtm:(short)value
{
[self willChangeValueForKey: @"atm"];
[self setPrimitiveValue: [NSNumber numberWithShort: value]
forKey: @"atm"];
[self didChangeValueForKey: @"atm"];
}
- (BOOL)validateAtm: (id *)valueRef error:(NSError **)outError
{
// Insert custom validation logic here.
return YES;
}
Does doing this cause a significant performance overhead over plain
old valueForKey? It did not seem to on my very simple tests, but
those were, as I said, simple. I suspect you guys have a better idea
of what valueForKey/setValue:forKey is doing in the background.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden