• 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
Apple guys: is the XCode generated CD accessor code decent?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Apple guys: is the XCode generated CD accessor code decent?
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Followup: Disk images and Fast User Switching...
  • Next by Date: Re: Making custom looks for controls
  • Previous by thread: Followup: Disk images and Fast User Switching...
  • Next by thread: Re: Apple guys: is the XCode generated CD accessor code decent?
  • Index(es):
    • Date
    • Thread