0

I have a swift application, which I would like to package with a different configuration (compile time as a requirement)

I've tried setting Other Swift Flags = -D FEATURE_A_ENABLED and in code:

#if FEATURE_A_ENABLED
  log("FEATURE_A IS ENABLED")
#endif

But nothing seems to work... any concrete sample, I've read In absence of preprocessor macros, is there a way to define practical scheme specific flags at project level in Xcode project

But I don't want to ride on the build configuration variable RELEASE/DEBUG for now, Is it possible to use a custom flag in Swift ? If so, what's the procedure if I want to inject the variable at compilation only, not via Xcode designer

Community
  • 1
  • 1
Ilan Levy
  • 191
  • 1
  • 2
  • 11

1 Answers1

1

Your flag formatting is correct except that there shouldn't be a space between -D and FEATURE_A_ENABLED. It should be -DFEATURE_A_ENABLED.

Mark Adams
  • 30,776
  • 11
  • 77
  • 77