4

I'm working on a Swift dynamic framework which has some Objective-C code in it. I need to use some legacy Objective-C code without exposing the code to it. I came to know that I can use a module map to avoid adding the headers as public in the framework. I have been using this link about how to create a module map. The module map I created looks something like this.

framework module Xyz {
  umbrella header "Xyz.h"
  export *
  module * { export * }
}

framework module Module1{
    header "Module1.h"
}

framework module Module2{
    header "Module2.h"
}

.... Rest of the modules

After this, I tried importing the module in the Swift file, but I didn't get auto-complete. I wrote the module name anyways and tried to build it. I got an error in the Swift file saying "Unable to build Objective-C module". In the module map file, I was seeing the error as "Unable to find the header". This was the error

enter image description here

So I tried adding the path $(SRCROOT)/ProjectName/ to the Include Path of the build settings. After which it was unable to find the umbrella header.

enter image description here

I scoured most of StackOverflow and Google, but I couldn't find anything that helped me. This is my first time working with module maps and I'm stuck here not knowing what to do further to resolve the issue. Would be great if someone can point out what I'm missing out or if you can suggest some other source which can help me out. Thanks!

Salman Ghumsani
  • 3,491
  • 1
  • 17
  • 32
ebby94
  • 2,981
  • 2
  • 20
  • 31

0 Answers0