Xcode using FIXME, TODO, ???,?

2019-03-08 05:24发布

I have started to use the FIXME, TODO, ??? and !!! tags in XCode but have am finding it painful that it does not recognise the tags when they are within a function. The tags are only recognised outside a given function.

How can I get these tags recognised within a function (as this is where the bugs are)?

8条回答
SAY GOODBYE
2楼-- · 2019-03-08 06:08

This is the script I use as an added build phase, note it excludes files pulled-in via Carthage (very annoying to get these as well otherwise since its not 'your' code) :

TAGS="WARNING:|TODO:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.swift" \) -not -path "${SRCROOT}/Carthage/*" -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"

Works well on xCode 9.3 with Swift 4

查看更多
手持菜刀,她持情操
3楼-- · 2019-03-08 06:10

Edited 2016-02-02

Xcode now supports //MARK:, //TODO: and //FIXME: landmarks to annotate your code and lists them in the jump bar.


To find those special markups (and actually any markups you specify yourself), you can use the search navigator, enter the following string and then choose "In Project, matching regex "...", ignore case":

(//FIXME|//!!!|//\?\?\?|//TODO)

This will search your project for all those special markups. You can even add any markup you would like to, e.g. "//REVIEW: please review the following code". This would then be the following search string:

(//FIXME|//!!!|//\?\?\?|//TODO|//REVIEW)

I created a tab in my workspace which has the search navigator always open, filled with this string. Unfortunately, XCode will sometimes remove this string from the searchbox, so you have to have it copy&paste ready whenever you need it.

查看更多
登录 后发表回答