如何在 Compile Sources 中设置编译器标志以从构建配置中省略文件

How to set compiler flags in Compile Sources to omit a file from a build configuration

我想在编译源中设置调试标志。但我不确定正确的方法是什么。我不想在构建发布时编译一些文件。

其他 Swift 标记屏幕截图:

编译源代码截图:

您需要在目标的构建设置中将 "Other Swift Flags" 设置为 -D DEBUG 以便您可以使用“#if/#else/#endif”预处理器宏。