How can I mark “To Do” comments in Xcode?

前端 未结 10 1163
别跟我提以往
别跟我提以往 2020-12-04 05:39

Currently I\'m working on an iOS based Image Manipulation task.

Problem:

I\'m working on different modules. So If I need to add something in a module in fu

相关标签:
10条回答
  • 2020-12-04 06:06

    I started with

    // TODO: Implement bubble sort.

    Then I joined a large project and sometimes I needed a todo to live longer than a WIP commit and so to distinguish my todos from my peers I name spaced my todo with my initials:

    // TODO: SM: Implement bubble sort

    Sometimes I wanted more visibility so I started to use pragma warnings in some places.

    #warning Implement bubble sort

    One day I decided to turn on hard mode by adding -Werror to my cflags. Unfortunately this makes pragma warnings useless because they prevent compilation. And so I went back to using // TODO: until Jeff Nadeau told me that I can put

    -Wno-error=#warnings

    in my cflags so as to not treat pragma warnings as errors. So now #warning and -Werror can live along side each other.

    0 讨论(0)
  • 2020-12-04 06:07

    You can use XToDo plugin

    https://github.com/trawor/XToDo

    use ctrl+t to trigger the List Window on/off

    use ctrl+t to trigger the List Window on/off

    Toolbar exemple

    Easy install with alcatraz use ctrl+t to trigger the List Window on/off

    0 讨论(0)
  • 2020-12-04 06:14

    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
    0 讨论(0)
  • 2020-12-04 06:14

    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.

    0 讨论(0)
  • 2020-12-04 06:17

    I tend to write exactly:

    //TODO: Blah blah blah
    

    Then I just do a COMMAND-SHIFT-F and look for "//TODO".

    Using the file outline drop down will only show you TODOs for the current file, but I tend to want to see my project's TODO status.

    Rough solution, but it does it's job.

    0 讨论(0)
  • 2020-12-04 06:19

    Another simple method, slightly outside the box, if you don't want to clutter up the methods listing bar, is to use a convention within comments like //Todo: and when you want to address them en-masse, simply select the Find Navigator, match case and search for //Todo:

    I prefer this as I don't like the methods drop down looking like spagetti-code. And yes, I often have lots of Todo:'s ;)

    0 讨论(0)
提交回复
热议问题