inexcii
inexcii

Reputation: 1631

How to show TODO FIXME inside a block in Xcode?

The title explains itself.

Here is the sample code:

[stillImageOutput captureStillImageAsynchronouslyFromConnection:stillImageConnection
    completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {

        // TODO: bla bla bla
    }
 ];

TODO will not show in the method list in xcode.

But if I move the TODO upon to the method(that means: outside the block), it will be shown normally.

// TODO: bla bla bla
[stillImageOutput captureStillImageAsynchronouslyFromConnection:stillImageConnection
    completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {

        // some codes
    }
 ];

Any tips or workaround? Thanks in advance.

Upvotes: 1

Views: 571

Answers (1)

jacob
jacob

Reputation: 3557

You can use:

#warning TODO: fix later...

to get a compile warning or

#error FIXME: fix now!

to get a compile error

You can also use a build script to mark them as warnings:

KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"

Credit: http://www.benzado.com/blog/post/329/make-xcode-nag-you-about-unfinished-todos

Upvotes: 1

Related Questions