Swift 3: how to use PREPROCESSOR Flags (like `#if DEBUG`)

0 votes
26 views
asked Apr 25 by admin (8,115 points)

Hi all  

#if DEBUG
static NSString *const API_KEY = @"KEY_A";
#else
static NSString *const API_KEY = @"KEY_B";
#endif


Not working properly in swift.

1 Answer

0 votes
answered Apr 25 by anonymous

Hi    

Try the below level settings changes

  • Open Build Settings for your target
  • Search for "other swift flags"
  • Add the macros you wish to use, preceded by the -D flag

...