Exposing Swift to Objective-C (only) within the same framework

Hi

We're building a binary framework and using Objective-C as the main language in the codebase with some files there written in Swift.

In order for us to expose our Swift classes to Objective-C, is by marking them public or open. As it's described here in Apple's documentation blog.

Now, that also exposes our Swift classes to the client too, and what we want is to expose them only to our framework target. Is there a way for us to do that?

Note: I quoted the following from Apple's docs.

Import Code Within a Framework Target

To import a set of Swift files in the same framework target as your Objective-C code, import the Xcode-generated header for your Swift code into any Objective-C .m file where you want to use your Swift code.

Because the generated header is part of the framework’s public interface, only declarations marked with the public or open modifier appear in the generated header for a framework target. Methods and properties that are marked with the internal modifier and declared within a class that inherits from an Objective-C class are accessible to the Objective-C runtime. However, they're inaccessible at compile time and don't appear in the generated header for a framework target.

Import Swift code into Objective-C within the same framework:

  1. Under Build Settings, in Packaging, make sure the Defines Module setting for that framework target is set to Yes.
  2. Import the Swift code from that framework target into any Objective-C .m file within that target using this syntax and substituting the appropriate names:
#import <ProductName/ProductModuleName-Swift.h>

Not today, unfortunately. See SR-5221.

Thanks @jrose,
I see the description of the feature says it needs changes at both ends, Swift and Xcode, which I think we will not get in the near future but I still hope we get it.