Skip to content

Instantly share code, notes, and snippets.

@kimuraw
Last active December 16, 2015 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimuraw/5373058 to your computer and use it in GitHub Desktop.
Save kimuraw/5373058 to your computer and use it in GitHub Desktop.
a sample of "InjectionTargets" of Xcode4 project template
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<!-- Specify an unique identifier -->
<!-- 固有の識別子を指定します -->
<string>jp.nifty.i.kimuraw.dt.unit.AddDebugLog</string>
<key>InjectionTargets</key>
<array>
<!-- Specify identifiers of target templates -->
<!-- インジェクション対象のテンプレートの識別子を指定します -->
<string>com.apple.dt.unit.singleViewApplication</string> <!-- iOS: "Single View Application" -->
<!-- <string>com.apple.dt.unit.cocoaApplication</string> --> <!-- Mac: "Cocoa Application" -->
</array>
<!-- "Definitions" defines your additional codes -->
<!-- "Definitions"で追加するコードを定義します -->
<key>Definitions</key>
<dict>
<key>___PACKAGENAME___-Prefix.pch:debuglog</key>
<string>#ifdef DEBUG
#define LOG(fmt,...) NSLog((@"%s %d "fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define LOG(...)
#endif</string>
</dict>
<!-- "Options" allows us to costomize new project by checkbox, text or popup -->
<!-- "Options"はチェックボックス、テキスト、ポップアップなどでプロジェクトをカスタマイズできるようにします -->
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>OWDebugLog</string>
<key>Name</key>
<string>Use "LOG()"</string> <!-- display text at side of this option -->
<key>Description</key>
<string>Whether use "LOG()" or not</string>
<key>Type</key>
<string>checkbox</string>
<key>SortOrder</key>
<integer>5</integer> <!-- display order of options -->
<key>Default</key>
<string>false</string> <!-- note: Xcode suggests previous selection -->
<key>Units</key>
<dict>
<key>true</key>
<!-- "true" -> merge the following settings into the new project -->
<dict>
<key>Nodes</key>
<array>
<string>___PACKAGENAME___-Prefix.pch:debuglog</string>
</array>
</dict>
</dict>
</dict>
</array>
</dict>
</plist>
@kimuraw
Copy link
Author

kimuraw commented Apr 12, 2013

Xcodeのプロジェクトテンプレートの"InjectionTargets"を使った例です。

iOSの"Single View Application"にデバッグ用のLOG()マクロを定義するかどうかを選ぶチェックボックスを追加します。詳細は日記のほうを見てください。 http://d.hatena.ne.jp/kimuraw/20130412/p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment