问题
In regards to a "dynamic framework" target, I need to bridge internal (private) objective-c
headers to my swift
counterparts.
From my understanding I need to use a private module.
Some of these swift counterparts are bridged back to objective-c using the @objc class TheClass
syntax.
I've gone ahead and created a module.modulemap
and a module.private.modulemap
file in a directory under $SRCROOT
and added the "necessary" flags to the build settings.
SWIFT_INCLUDE_PATHS =>$(SRCROOT)/...
I've also tried adding a "Private module map file" to the build settings
My module map file is:
module InnerModule {
export *
}
and the private module file is:
explicit module InnerModule.Private {
header "../Classes/Header1.h"
header "../Classes/Header2.h"
...
export * // and have tried without it
}
In all of the relevant Swift files I've added
import InnerModule.Private
Now when building the project I get an error in my swift bridge header
#import <MyFramework/MyFramework-Swift.h> // getting an error here
MyFramework-Swift.h // generated header file
@import UIKit;
@import ObjectiveC;
@import InnerModule.Private; Module InnerModule not found
How can this be fixed?
回答1:
Turns out that after you compile the framework you can go to the framework header, delete all the "private" headers you don't want to expose.
After that you can delete all of the header files you don't want to expose from the "Headers" directory.
Works as expected
来源:https://stackoverflow.com/questions/34998570/ios-mixed-dynamic-framework-bridge-objc-headers-with-private-module