• 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
Implementing custom accessors in core data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implementing custom accessors in core data


  • Subject: Implementing custom accessors in core data
  • From: Knud Möller <email@hidden>
  • Date: Wed, 18 Jan 2006 14:25:39 +0000

Hi,

I understand that, if I don't want to write my own custom accessors for core data, I use valueForKey: and setValueForKey: (for attributes) or manipulate the result of mutableSetValueForKey: (for relations). Now, the core data programming guide gives detailed information on how to implement custom accessors if needed (basically calling the relevant KVO methods). I wonder: why can't I just implement convenience accessor methods like this:

- (NSString *)name
{
    return [self valueForKey: @"name"];
}

- (void)setName: (NSString *)name
{
    [self setValue: name forKey: @name];
}

Would this work? Or does the existence of custom accessors prevent the valueForKey/setValueForKey methods from working properly?

If this has been answered before, my apologies.

Cheers,
Knud
-------------------------------------------------
Knud Möller, MA
+353 - 91 - 495086
Digital Enterprise Research Institute
  National University of Ireland, Galway
Institiúid Taighde na Fiontraíochta Digití
  Ollscoil na hÉireann, Gaillimh


_______________________________________________ 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: Implementing custom accessors in core data
      • From: Chris Hanson <email@hidden>
    • Re: Implementing custom accessors in core data
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: "Open dialogue"-like file system browser
  • Next by Date: Re: NSTimers
  • Previous by thread: Re: NSTimers
  • Next by thread: Re: Implementing custom accessors in core data
  • Index(es):
    • Date
    • Thread