• 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: How to avoid excessive hard coding when programatically inserting Core Data entity ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid excessive hard coding when programatically inserting Core Data entity ?


  • Subject: Re: How to avoid excessive hard coding when programatically inserting Core Data entity ?
  • From: Shawn Erickson <email@hidden>
  • Date: Sun, 16 Sep 2007 08:16:36 -0700


On Sep 16, 2007, at 8:01 AM, Shawn Erickson wrote:


On Sep 16, 2007, at 7:38 AM, Erik Buck wrote:

Does anyone have suggestions for how to reduce the amount of hard coding going on ?

Not knowing exactly what you mean by hard coding in this context...

@implementation VT4ImageGraphic (VT4Utility)

+ (VT4PointVector*) pointVectorWithPoint:(NSPoint)aPoint inContext: (NSManagedObjectContext*)
{
// Create an entity to store the position of the image
VT4PointVector *newPoint = [NSEntityDescription insertNewObjectForEntityForName:@"VT4PointVector"
i nManagedObjectContext:aManagedObjectContext];
[newPoint setX:[NSNumber numberWithFloat:aPoint.x]];
[newPoint setY:[NSNumber numberWithFloat:aPoint.y]];
return newPoint;
}

I should also note that since you appear to be subclassing NSManagedObject to provide named accessors for your various objects consider having those subclasses provide methods like the above. This would hide the entity aspects of things from clients.


-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >How to avoid excessive hard coding when programatically inserting Core Data entity ? (From: Erik Buck <email@hidden>)
 >Re: How to avoid excessive hard coding when programatically inserting Core Data entity ? (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: NSTextView, partial views of NSTextStorage
  • Next by Date: Re: Mixing C++ and Obj-C (odd compile errors)
  • Previous by thread: Re: How to avoid excessive hard coding when programatically inserting Core Data entity ?
  • Next by thread: Re: How to avoid excessive hard coding when programatically inserting Core Data entity ?
  • Index(es):
    • Date
    • Thread