#ifdef replacement in the Swift language
Asked 07 September, 2021
Viewed 2.3K times
  • 51
Votes

In C/C++/Objective C you can define a macro using compiler preprocessors. Moreover, you can include/exclude some parts of code using compiler preprocessors.

#ifdef DEBUG
    // Debug-only code
#endif

Is there a similar solution in Swift?

17 Answer