Skip to content

Instantly share code, notes, and snippets.

@vikdenic
Created June 2, 2015 21:41
Show Gist options
  • Select an option

  • Save vikdenic/58646a5d2c95e021dced to your computer and use it in GitHub Desktop.

Select an option

Save vikdenic/58646a5d2c95e021dced to your computer and use it in GitHub Desktop.
init managedobject
-(instancetype)initWithName:(NSString *)name andGeoPoint:(PFGeoPoint *)geoPoint {
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
self = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([CDRegion class]) inManagedObjectContext:appDelegate.managedObjectContext];
self.name = name;
self.longitude = [NSNumber numberWithDouble:geoPoint.longitude];
self.latitude = [NSNumber numberWithDouble: geoPoint.latitude];
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment