• 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
Re: Subclassing NSManagedObject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSManagedObject


  • Subject: Re: Subclassing NSManagedObject
  • From: T Reaves <email@hidden>
  • Date: Sun, 22 May 2005 20:40:34 -0400


On May 22, 2005, at 8:29 PM, Chris Hanson wrote:

On May 22, 2005, at 3:01 PM, T Reaves wrote:

For my accessors & mutators, do I really need to go through all the steps as outlined in Apple's docs?


Yes.


If they are simple accessors & mutators, can I do

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


You can't do this because -valueForKey: and -setValue:forKey: when passed the key @"name" will invoke -name and -setName: if they're present.


You also can't avoid the -will/didAccess and -will/didChange invocations around access to the primitive value.

  -- Chris




O.K., fair enough; it looks at 'self' first, sees the methods, and loops.

_______________________________________________
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


References: 
 >Subclassing NSManagedObject (From: T Reaves <email@hidden>)
 >Re: Subclassing NSManagedObject (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: CoreData relationships in IB
  • Next by Date: Subclassing NSManagedObject issue
  • Previous by thread: Re: Subclassing NSManagedObject
  • Next by thread: take pity on rank beginner
  • Index(es):
    • Date
    • Thread