0

I'm working on Swift framework implementation and trying to use the closed source Objective-C framework (let us call it 'InternalObjectiveC.framework') provided by vendor in Swift framework( let us call it 'ExternalSwift.framework').

The problem: The 'InternalObjectiveC.framework' doesn't have modulemap or SwiftModule. When I try to use the Objective-C classes (declared in 'InternalObjectiveC.framework') from Swift code (of 'ExternalSwift.framework') the Xcode cannot find them

I've tried to use Bridging Header, but faced with issue

"error: using bridging headers with framework targets is unsupported"

Also I've tried to make umbrella framework to expose the headers - it works.

My question is:

Is there a better way to make interoperability between Swift framework and the Objective-C framework(which doesn't have modulemap)?

Already checked other answers: iOS mixed dynamic framework - bridge objc headers with private module, Embedded Frameworks in Swift/iOS: Cocoapods-Packager dependency ModuleMap error (.modulemap' not found / underlying Objective-C module not found), Objective-C Bridging Header for frameworks

1ce
  • 283
  • 3
  • 10
  • The module map is not too incredibly complex. You might be able to write your own module map for the framework even though the vendor doesn't supply one. – Scott Thompson Oct 28 '21 at 14:37
  • @ScottThompson,Thank you. Agree, the modulemap itself is not complex, it's just a declaration of imports, but where should I place it and how should I configure the location to make it working? Whatever I tried so far - Xcode didn't saw the classes. – 1ce Oct 28 '21 at 18:22

1 Answers1

0

In my case, i didn't need 'InternalObjectiveC.framework' modulemap. But i created modulemap for Swift framework. Something like this:

module InternalObjectiveC {
    header "Pods/InternalObjectiveC/InternalObjectiveC.framework/Headers/InternalObjectiveC.h"
    export *
}

Then in Build Settings, i searched for 'Import Path' and provide it new module.modulemap path. For example '$(SDKROOT)/ProjectModule'

Then i was able to compile all the things, Hope this help.

Hai Hoang
  • 15
  • 7