ArticleDirectory
- Instructions
- Bash script for "run script" build phase
In xcode 3, we can use annotations like this to easily mark the parts to be modified:
// Todo:
// Fixme:
//!!! :
//??? :
Xcode 4 does not support this function. There is a solution on the Internet to forward it:
Original article: http://deallocatedobjects.com/posts/show-todos-and-fixmes-as-warnings-in-xcode-4
Here's a neat little snippet for xcode 4 that will cause all of your// Todo:
And// Fixme:
Comments in your code to appear as compiler warnings when you build. Here's how to use it:
Instructions
- Enter the page for setting Project Properties
- Select a target
- Select build phases label
- Click Add build phase in the lower right corner.
- Show the run script in the column shown above and enter the following content
- Head over to your project's item in the project navigator (usually at the very top)
- Find your target in the list of targets on the left, select it
- Head over to the "build phases" tab.
- Click the "add build phase" in the bottom right of this screen.
- In the editor that appears Insert the bash script shown below.
Now just build and you'll see all your// Todo:
And// Fixme:
Comments have become warnings. I love this technique, it might not be right for everyone, but hope it helps someone.
Bash script for "run script" build phase
KEYWORDS = "Todo: | fixme: | \? \? \? : | \! \! \! : "Find" $ {srcroot} "\ (-name "*. H "-or-name "*. M "\)-print0 | xargs-0 egrep -- With-filename -- line-number -- only-matching" ($ keywords ). * \ {1} quot; | Perl-p-e "s/($ keywords)/warning: \ $1 /"
You'll also be able to click on each of the warnings in the issue navigator to go right to the file and point in your code where you left the original// Todo:
Or// Fixme:
Extra pro tip: Make sure you're using phrases to describe your// Todo:
Comments like// Todo: handle this error gracefully
, And things like that. The phrases will show up in the issues list beside each warning.
In this way, it can be displayed in the document item, and there will be a prompt in the compiled warning!