1

under Active Compilation Conditions i have added a new flag (for debug only) called SOMEFLAG. the check is implemented like so and works great:

#if SOMEFLAG
   print("SOMEFLAG is true");
#endif

it actually prints like i would expect. now, i need to examine the same flag from Objective-C class and it never evaluates to true. any idea why? should i make this flag in other way? in general my goal is to be able to detect when it is executed from another target, the build is triggered from the cli. if there is other way that less limiting i would like to know.

thanks!

1

1 Answer 1

1

In Objective-C (and other C-like languages that use a preprocessor) the canonical way to check whether a symbol is defined would be using #ifdef, not #if. There is an #if directive in Objective-C, but it doesn't behave quite the same way as the Swift #if compiler directive.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.