Matthieu Riegler
Matthieu Riegler

Reputation: 55634

Swift preprocessor if not flag

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.

Upvotes: 44

Views: 12648

Answers (1)

Matthieu Riegler
Matthieu Riegler

Reputation: 55634

I wasn't trying enough, I found out

#if !myFlag 

#endif 

works well !

Upvotes: 120

Related Questions