Swift: #warning equivalent

前端 未结 14 1663
無奈伤痛
無奈伤痛 2020-11-28 18:52

Does Swift have a #warning equivalent? It\'s simply used to show a warning in Xcode\'s own GUI

I\'m also interested in whether there\'s a #error equivalent.

14条回答
  •  时光说笑
    2020-11-28 19:00

    Look at this article.

    You can write your own script which will highlight all tags.

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

    This results to:

提交回复
热议问题