在 Xcode 的 Build Settings 中,我们总是在“Other Swift Flags”中使用“-D XX”。 “-D”的用途和正确用法是什么?
如果我们不使用前缀“-D”,结果会是什么
最佳答案
-D 表示您定义的标识符,用于构建配置语句,如内置 os()、arch() 和 swift()。
请参阅 Apple 文档:Swift Programming Language: Statements
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...
关于ios - 其他 swift 标志中 "-D"的含义是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37045578/