Re: How to avoid excessive hard coding when programatically inserting Core Data entity ?
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:01:39 -0700
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"
inManagedObjectContext:aManagedObjectContext];
[newPoint setX:[NSNumber numberWithFloat:aPoint.x]];
[newPoint setY:[NSNumber numberWithFloat:aPoint.y]];
}
etc.
+ (void)insertWithImage:(NSImage *)anImage atPoint:(NSPoint)aPoint
inManagedObjectContext:(NSManagedObjectContext *)aManagedObjectContext
{
if(nil != anImage)
{
NSAssert(nil != aManagedObjectContext, @"Invalid managed
object context");
VT4PointVector* point = [self pointVectorWithPoint:aPoint inContext:
aManagedObjectContext];
etc.
_______________________________________________
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