define(_:_:)
Defines a compilation condition.
Declaration
static func define(_ name: String, _ condition: BuildSettingCondition? = nil) -> SwiftSettingParameters
- name:
The name of the macro.
- condition:
A condition that restricts the application of the build setting.
Discussion
Use compilation conditions to only compile statements if a certain condition is true. For example, the Swift compiler will only compile the statements inside the #if block when ENABLE_SOMETHING is defined:
#if ENABLE_SOMETHING
...
#endifUnlike macros in C/C++, compilation conditions don’t have an associated value.