5

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.

Rafał
  • 1,237
  • 1
  • 11
  • 21

2 Answers2

0

Remove your current import statements so the project compiles.

Build your project.

Try and import again.

Blake Lockley
  • 2,931
  • 1
  • 17
  • 30
0

There is something wrong with your module. I believe in your TSUI project you need to set a modulemap file. You should have a file that just imports all of the files you would like to include in the module. You can call it TSUI-umbrella.h. In your modulemap you should set this as your umbrella header. Then when you run @import (which imports the module) you will get a proper compilation. Additionally you can do

#import <TSUI/TSUI-umbrella.h>

or basically

#import <ModuleName/UmbrellaHeader>
arc4randall
  • 3,275
  • 3
  • 27
  • 40