Swift: #warning equivalent

前端 未结 14 1666
無奈伤痛
無奈伤痛 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:07

    As an alternative, if you want something to show up in the warnings panel, you could write something like:

    if (false){
       var x = 2;
    }
    

    You can't really get any text to show up, but at least it's a more visible marker, especially if you tend to treat (most) warnings like errors.

提交回复
热议问题