Swift: #warning equivalent

前端 未结 14 1630
無奈伤痛
無奈伤痛 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条回答
  •  萌比男神i
    2020-11-28 19:13

    We wrote a configurable tool that lets you put warnings and errors in Xcode Issue Navigator based on comment tag and build configuration: https://github.com/doubleencore/XcodeIssueGenerator

    Install it:

    brew tap doubleencore/tap
    brew install xcodeissuegenerator
    

    Then put a line in a Run Script Build Phase:

    # Mark WARNINGs, SERIOUSs, and TODOs as warnings in DEBUG builds excluding the Vendor and Third Party directories.
    XcodeIssueGenerator -b DEBUG -w "WARNING, SERIOUS, TODO" -x "Vendor/, Third Party/"
    

    Here's an article describing how we use it.

提交回复
热议问题