Xcode Macro Code Highlighting - Choosing The Wrong Target

I have two targets:

  • App
  • Share Extension

Each has a preprocessor macro:

  • TARGET_IS_APP
  • TARGET_IS_EXTENSION

The App target has a dependency on the share extension.

Some source files are compiled in both targets, but I use the preprocessor macros to enable/disable code for each target.

lately Xcode hasn't been handling the code coloring very well based on the selected build target.

I'll be in a file, my selected target is the App, but it will disable the code in the TARGET_IS_APP macro and enable it for share extension.

The attached image shows an example. My selected build target/scheme is the App. But it's disabling that code and enabling the share extension.

I've double checked the build settings, they are defined in the right targets.