Export ProductModuleName-Swift.h to other targets?

Viewed 165

As described here, it is possible to use Swift code from objective-c in the same target using

#import <ProductName/ProductModuleName-Swift.h>

Importing from an external framework can be done with

@import FrameworkName;

However, this only works when "Enable Modules" is set. Assuming "Enable Modules" can not be set on the target that wants to import the Swift code, my question is:

Is it possible to make the ProductModuleName-Swift.h header public, so that it can be accessed from other targets?

1 Answers

It appears that when creating a Framework, the ProductModuleName-Swift.h` is automatically added to the public headers of the framework, including all "public" swift classes. So the first method can be used even when importing from an external framework!

(Not sure why I missed this/why this didn't work when asking the question...)

Related