Search code examples
objective-ccore-datamogenerator

New objects on mogenerator


Im new using Mogenerator (it looks great!). I just can't figure out how is the equivalent sentence to: NSManagedObject *mo = [NSEntityDescription ...]

How should I create new objects in Mogen?

Thanks in advance.


Solution

  • The usual NSManagedObject *mo = [NSEntityDescription ...] method will still work, otherwise mogenerator provides a + (id)insertInManagedObjectContext:(NSManagedObjectContext *)context; method which you'd call like:

    NSMangedObject *mo = [MyModel insertInManagedObjectContext:moc];
    

    To see any other methods mogenerator creates you can take a look at the _MyModel.h files it generates.