42

Is there a Swift compiler directive for #if not?

I know this could work

#if myFlag
    // ignore
#else 
    bar()
#endif

But it is not pretty if there is nothing between if and else.

user16217248
  • 3,119
  • 19
  • 19
  • 37
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134

1 Answers1

114

I wasn't trying enough, I found out

#if !myFlag 

#endif 

works well !

Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134