How do I use Mogenerator?

前端 未结 6 1668
逝去的感伤
逝去的感伤 2020-12-31 01:43

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

The first problem I have is that I have no idea where it was installed to. During the install process, it

6条回答
  •  甜味超标
    2020-12-31 02:22

    One more caveat to be aware of: You have to already set the Class properties of your entities to something different than NSManagedObject. Otherwise Xmo'd won't do anything.

    Note: Xmo'd currently doesn't work with Xcode 4/5, afaik.

    What I do is just add a "MOGenerator" target in Xcode:

    1. Go to your project and click on "Add Target..." in the "Targets" section.
    2. Choose "iOS -> Other -> Aggregate"
    3. Go to "Build Phases"
    4. Select from the Menu "Editor -> Add Build Phase -> Add Run Script Build Phase"
    5. Paste your 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 your MOGenerator-generated by simply running this target.

提交回复
热议问题