Re: Generate attributes from model
Re: Generate attributes from model
- Subject: Re: Generate attributes from model
- From: Don Briggs <email@hidden>
- Date: Thu, 16 Jun 2005 22:58:48 -0500
On Jun 16, 2005, at 4:50 PM, Post wrote:
I just started writting a cli app with core data. I figured out that i
would be nice for complex models to draw them in the modeling tool and
generate all the attributes and relations for it in a file since its
not an option to store the .mom anywhere in the system (Maybe there
should be a folder similar to the framework folder where all .mom
files are stored). Modeling the schema is pretty fast but writting
that stuff in code takes a lot of time which can be handled by some
kind of exporter tool.
Xcode can generate class files from a xcdatamodel file.
In the pre-release NDA versions, this feature was a little obscure;
perhaps it still is.
Try this:
[1] Open the data model file you've drawn.
[2] Select some entities, perhaps all of them.
You can select them in the table or in the drawing.
[3] Choose the menu item
Xcode -> File -> New File
[4] a sheet appears:
Under the heading "Design," choose "Managed Object Class."
The lower split view shows the text: "Generate Managed Object
classes for entities" -- Hey!
[5] Punch the "Next" button.
Choose a destination folder for your classes and a target.
(The new classes should belong to a target.)
[6] Punch the "Next" button.
A table allows you to deselect entities.
Check boxes below let you generate accessors and validation
methods.
[7] Punch "Finish".
If your entities had distinct class names (not set to be
NSManagedObject) you'll get ivar declarations as well.
Don
_______________________________________________
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