@import X; Causes error Could not build module X

Viewed 1538

I have a custom framework TSUI defined as a module. It has both Objective-C and Swift code. If I import it in Objective-C code as follows:

#import <TSUI/TSUI.h>

Everything works just fine, but then I get only access to the Objective-C code. However, if I import it as:

@import TSUI;

or

#import <TSUI/TSUI.h>
#import <TSUI/TSUI-Swift.h>

Everything compiles fine, but in Xcode I get the following error: enter image description here

In both the framework and the app code I've set the following build settings:

  • Embedded content contains Swift code = YES
  • Allow Non-Modular Includes In Framework Modules = YES
  • Enable Modules = YES

I've tried cleaning the project, cleaning the derived data, and the issue keeps coming back. It also appears if the framework contains no Swift code but is included with @import instead of #import. At the moment I would consider it to be a bug.

2 Answers
Related