1. Template folder location
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates
/Users/<username>/Library/Developer/Xcode/Templates/
mkdir -p ~/Library/Developer/Xcode/Templates
2. The Templates are in folders like
iPad Base.xctemplate, iPhone Base.xctemplate, Cocoa Touch Application.xctemplate
View-based Application.xctemplate Window-based Application.xctemplate
3. The Ancestors, Definitions and Options are defined in TemplateInfo.plist
4. To add files in the Template, you should define them in Definitions like
<key>Definitions</key>
<dict>
<key>___PACKAGENAMEASIDENTIFIER___MyController.h</key>
<dict>
<key>Group</key>
<string>My Classes</string>
<key>Path</key>
<string>Classes/___PACKAGENAMEASIDENTIFIER___MyController.h</string>
</dict>
<key>___PACKAGENAMEASIDENTIFIER___MyController.m</key>
<dict>
<key>Group</key>
<string>My Classes</string>
<key>Path</key>
<string>Classes/___PACKAGENAMEASIDENTIFIER___MyController.m</string>
</dict>
<key>README</key>
<dict>
<key>Path</key>
<string>README</string>
<!-- excluded in targets -->
<key>TargetIndices</key>
<array/>
</dict>
<!-- Other definitions here -->
</dict>
Also define in Nodes
<key>Nodes</key>
<array>
<string>___PACKAGENAMEASIDENTIFIER___MyController.h</string>
<string>___PACKAGENAMEASIDENTIFIER___MyController.m</string>
<string>README</string>
<!-- Other nodes here -->
</array>
5. To add build stage for existing Target
<key>Targets</key>
<array>
<dict>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>ShellScript</string>
<key>ShellPath</key>
<string>/bin/bash</string>
<key>ShellScript</key>
<string>ls -l</string>
</dict>
</array>
</dict>
<!-- Other targets here -->
</array>
6. Add New Target
<key>Targets</key>
<array>
<!-- Default target here -->
<dict>
<key>Name</key>
<string>My Target for ___PACKAGENAME___</string>
<key>TargetType</key>
<string>Aggregate</string>
<key>SharedSettings</key>
<dict>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
</dict>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>ShellScript</string>
<key>ShellPath</key>
<string>/bin/bash</string>
<key>ShellScript</key>
<string>ls -l</string>
</dict>
</array>
</dict>
</array>
For ShellScript, please use html codes like these
< | < |
> | > |
& | & |
.
.
.
No comments:
Post a Comment