生成 Swift NSManagedObject 子类。
为什么比 Xcode 生成更好?
为什么比 Mogenerator 更好?
此外,它允许为整个模型生成一个文件,例如,您需要实体名称列表
通过从 最新的 GitHub 发布页面 下载 MotoSwift.pkg 并运行来安装 MotoSwift。
从源代码安装。
克隆或下载项目。
运行 make install
如果您需要将所有组件放在一个文件夹中,请运行 make bundle。 现在您可以复制整个 motoswift 文件夹,并从任何位置运行 motoswift/bin/motoswift
motoswift human [选项] 模型路径 - 为您的模型生成人类可读的代码。 如果文件已存在,则不覆盖文件
选项
motoswift machine [选项] 模型路径 - 为您的模型生成机器可读的代码。 每次都覆盖文件
选项
motoswift model [选项] 模型路径 - 为您的模型生成代码
选项
motoswift human --template ./Templates/xcode/class.stencil --output ./SampleOutput/Xcode --file-mask "{{class}}+CoreDataClass.swift" ./Tests/MotoSwiftFrameworkTests/Resources/TypesModel.xcdatamodeld
motoswift machine --template ./Templates/xcode/properties.stencil --output ./SampleOutput/Xcode --file-mask "{{class}}+CoreDataProperties.swift" ./Tests/MotoSwiftFrameworkTests/Resources/TypesModel.xcdatamodeld
motoswift human --template ./Templates/mogenerator/human.stencil --output ./SampleOutput/Mogenerator/Human --file-mask "{{class}}.swift" ./Tests/MotoSwiftFrameworkTests/Resources/TypesModel.xcdatamodeld
SampleOutput/Mogenerator/Human
motoswift machine --template ./Templates/mogenerator/machine.stencil --output ./SampleOutput/Mogenerator/Machine --file-mask "_{{class}}.swift" ./Tests/MotoSwiftFrameworkTests/Resources/TypesModel.xcdatamodeld
SampleOutput/Mogenerator/Machine
motoswift model --template ./Templates/model.stencil --output ./SampleOutput/Model/Model.swift ./Tests/MotoSwiftFrameworkTests/Resources/TypesModel.xcdatamodeld
SampleOutput/Model/Model.swift
make test
make .package
MotoSwift 使用 Stencil 作为模板语言