How to use Mogenerator?

I installed Mogenerator . Now what should I do? How to use it?

The first problem is that I have no idea where it was installed. During the installation process, it allows me to select the hard drive for installation, and not in the directory. The most natural place will be the Applications folder, but it is not there.

Next, readme (which I found on the Internet):

Xmo'd works by noticing when your * .xcdatamodel is saved. If the comment on the Xcode project element of the model file contains xmod, AppleScript is fired which creates a folder based on your model file name and populates it with the derived source code files from your model. He then adds a new folder to your project as a Link group and adds the entire file source to your project.

There are several issues with the above statement that are not clear:

  • What does โ€œcomment on an Xcode file project elementโ€ mean? How can I make it contain "xmod"?
  • Adds this comment and has mogenerator tracks the .xcdatamodel file the only way to use mogenerator? Is there a way to manually start mogenerator so that it recreates the generated files?
+18
plugins installation xcode core-data mogenerator
Aug 25 2018-10-10 at
source share
7 answers

mogenerator is a script that, as I recall, is installed in your developer directory. However, it can be installed in the Xcode script directory in your ~ / Library.

What do you mean by manually launching the application? You can call the assembly by โ€œtouchingโ€ the data model. Any persistence in the data model will create an assembly.

In Xcode, if you select a model file and press "โŒ˜I", you will get its metadata. Go to the comments tab and add xmod. mogenerator is looking for this comment to know if it should generate files.

Update

You can run mogenerator from the command line, as well as track your files. Type mogenerator --help in the terminal to view the options.

+9
Aug 25 '10 at 5:53
source share

Another caveat you need to know: you should already set the class properties of your objects to something other than NSManagedObject. Otherwise, Xmo'd will do nothing.

Note : Xmo'd does not currently work with Xcode 4/5, afaik.

What I'm doing is just add the target "MOGenerator" to Xcode:

  • Go to your project and click "Add Goal ..." in the "Goals" section.
  • Choose "iOS โ†’ Other โ†’ Aggregate"
  • Go to the phase assembly section.
  • Select from the menu "Editor โ†’ Add Build Stage โ†’ Add Run Script Build Phase
  • Paste the MOGenerator command into the Run Script section, for example:
 PATH=${PATH}:/usr/local/bin cd "${PROJECT_DIR}/MyApp" mogenerator --human-dir Classes --machine-dir MOGenerated --model MyApp.xcdatamodeld/MyApp.xcdatamodel --template-var arc=true 

Now you can update the generated MOGenerator by simply running this target.

+17
Oct 21 '10 at 10:52
source share

I searched my hard drive and found the following files:

The application is installed on: /usr/bin/mogenerator .

The /Library/Application Support/mogenerator/ contains several .motemplate files.

+6
Aug 25 '10 at 6:31
source share

โŒ˜ I no longer work in Xcode 4. check the command line tool. Here is the doc

+2
Feb 02 '13 at
source share

Studying line 22 from make_installer.command , I found that /Developer/Library/Xcode/Plug-ins/Xmod.pbplugin also installed.

And then, looking for mogenerator GitHub Issues for "uninstall", I found an official one on how to remove mogenerator from the creator.

0
Apr 23 2018-11-11T00:
source share

Xcode 4 users who cannot use the answers above go here and follow the instructions.

0
May 28 '13 at 9:45
source share

using a generator:

  • download mogenerator

  • start and build a mogenerator project

  • find the embedded file in the product group enter image description here

  • copy the embedded file to the /usr/bin

  • copy this code in the terminal and press enter: mogenerator -m /Users/hashem/Desktop/Projects/myApp/myAppModel.xcdatamodel -O /Users/hashem/Desktop/Projects/myApp/managedObjects --template-var arc=true

NOTE: here I first entered the path to myApp.xcdatamodel, and the next path is the location of the generated files. if the file path contains a space character, be sure to add the \ character before the space in the file path. e.g. /desktop/xcode\ projects/myApp/....

enjoy it!

0
Jun 30 '14 at 19:33
source share



All Articles