Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I mark "To Do" comments in Xcode?

Tags:

xcode

People also ask

How do I mark a comment in Xcode?

Adding a // MARK: comment to your codeXcode Mark Lines are added through commented code. Xcode parses those comments into chapter lines within the method navigator.

How do you add a TODO comment in Swift?

Add a heading: Insert a comment with the prefix MARK:. For example: // MARK: [your section heading]. Add a separator line: To add a separator above an annotation, add a hyphen (-) before the comment portion of the annotation.

How do I comment out multiple lines in Xcode C++?

Is there a way to comment various lines at the same time in Xcode IDE? Selecting which lines to comment, then clicking somewhere et voilá.. the /* ... */ characters wrapping the code. Thank you.

How do you comment multiple lines in Swift?

There are two ways to add comments in Swift: // - Single Line comments. /*... */ - Multiline Comments.


I got it.

Writing comment like:

// TODO: Do something

Will do the trick.

I got something like:

TO DO


Also there is a lot of options like:

  1. // FIXME: Midhun

  2. // ???: Midhun

  3. // !!!: Midhun

  4. // MARK: Midhun

// TODO: the thing todo

Is how you show todo tasks.


Using the

//TODO: some thing here

works if all you want to do is to look at the list of todos in the drop down

If you want to be intrusive you can use #warning marks instead:

#warning this will create a compiler warning.

And when you build the app you will get a compiler warning (a yellow triangle, not a compiler error) which is a little more "in your face" about reminding you of things you need to do.


With the script below your can see all required tags like warnings.

  1. Select your project in the Project Navigator
  2. Open the target in the sidebar and move to the "Build Phases" tab
  3. Click on "+" sign
  4. Select "New Run Script Build Phase" Script adding
  5. Add below script to "Run Script" Ready Script The script:

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

enter image description here

Original answer was taken from Here

Another alternative is XToDo plugin for Xcode.