Example:
#ifdef FREE_VERSION
tf.text = @"Free";
NSLog(@"FREE VERSION");
#else
tf.text = @"Paid";
NSLog(@"PAID VERSION");
#endif
The first part looks fine in Xcode.
tf.text = @"Free";
NSLog(@"FREE VERSION");
is syntax-highlighted. However, the second part is not:
tf.text = @"Paid";
NSLog(@"PAID VERSION");
Is there a setting like "Don't do syntax highlighting in #else parts of conditional cimpilation code"?
XCode will try and determine which preprocessor branch will be taken. The branch that is expected to execute will have syntax highlighting while the other does not.
Most IDEs including XCode and Visual Studio won't highlight code in (non-taken) conditional blocks because in many cases this would result in errors that don't apply and messed up highlighting. Consider a usage such as
#ifdef __APPLE__
// Do something that uses apple-only headers/functions
#endif
#ifdef _MSVC_VER
// Do something that visual studio recognizes
#endif
for code that runs on multiple platforms. Visual Studio won't have any idea how to highlight Apple function names and XCode won't know what to do about Visual Studio pragmas etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With