在Xcode的构建设置中,我们总是在“其他Swift标志”中使用“-D XX”。 "-D"的目的和正确使用方式是什么?
如果不使用前缀“-D”,会有什么结果?
如果不使用前缀“-D”,会有什么结果?
A build configuration statement allows code to be conditionally compiled depending on the value of one or more build configurations.
Every build configuration statement begins with #if and ends with #endif. A simple build configuration statement has the following form:
#if build configuration statements #endif
Unlike the condition of an if statement, the build configuration is evaluated at compile time. As a result, the statements are compiled and executed only if the build configuration evaluates to true at compile time.
The build configuration can include the true and false Boolean literals, an identifier used with the -D command line flag, or any of the platform or language-version testing functions listed in the table below...
-D定义一个宏,供预处理器使用。