Make changes to Xcode project templates

2019-09-09 08:41发布

问题:

I have read a few posts about creating/editing Xcode project templates, but they don't seem to work with Xcode 5.

The directory in which I have to make changes is, /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate

However, I can't figure out a place where I can make changes and include the header files and other statements that I wish to add.

I have even tried editing C++ class in the File Template. However, the problem is that the custom class comes into play only when I add a new c++ class to the project. No changes are visible are in main.cpp

回答1:

You have the project file here which sets up the base files needed and not extra files.

When you add a new file you us a template under /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates

To do this for a C++ class copy /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/C and C++/C++ Class.xctemplate to ~//Library/Developer/Xcode/Templates/File Templates/<myGroup>/C++ File.xctemplate (replacing by the group name you want. Then edit the files in this target directory.