preprocessing Directives
The Swift compiler does not contain pre-processors. Instead, it takes advantage of compile-time properties to generate configuration and language features to accomplish the same functionality. Therefore, Swift does not introduce pre-processing instructions.
Simple Macro
In C and objective-c, you typically use a # define directive that defines a basic constant in swift, which you can use instead of global constants. For example: A global definition of # define Fade_animation_duration 0.35, in which Swift can use let Fade_animation_duration = 0.35来 a better representation. Because simple macros that define constants are directly mapped to Swift Global, the Swift compiler automatically introduces simple macros defined in C or objective-c source files.
Complex Macros
Complex macros used in C and objective-c do not have replicas in swift. Complex macros are macros that are not used to define constants, including function-style macros with parentheses. You use complex macros in C and objective-c to avoid the restriction of type checking, or to avoid retyping a large number of boilerplate code. However, macros can also cause bugs and refactoring difficulties. In Swift you can use functions and generics to achieve the same effect without any compromises. Therefore, complex macros defined in the C and Objective-c source files are not available in Swift.
compiling the configuration
Swift code and C, objective-c code are conditionally edited in different ways. Swift code can be conditionally compiled based on the evaluation of the build configuration. The build configuration includes true and false literals, command-line flags, and platform test functions in the following table. You can use-d <#Flag#> to specify command-line flags.