Objective C to Swift header file with multiple targets

header-files, objective-c, swift, target

Solution

It is also possible to set the `Product Module Name` setting in `Build Settings` to be the same across your modules (I set it to `$(PROJECT_NAME)`), so that the `<project>-Swift.h` file that is generated has the same name across all modules. This eliminates the need for adding/checking preprocessor macros.

Problem

I'm successfully calling my Swift classes from Objective C (for target 'MyApp') via the import statement: ``` #import "MyApp-Swift.h" ``` I've now created a new target called "MyAppLite" When I compile the new target, I get errors because "MyApp-Swift.h" is required by the code, but the compiler is creating "MyAppLite-Swift.h" So, I need to create a conditional Swift/ObjC header `#import` for the target I'm compiling against. How can this be done, or is there a better way?

Original source