Mixed objective-c swift framework missing Undefined symbols for architecture arm64: "nominal type descriptor for with exported symbols set

We are creating a framework with lots of c and c++. There is a wrapper of objective-c around that that works fine. Just as we started moving to a mixed objective-c & Swift framework nasty things started popping up. Most of them we solved and it compiles now. We can also use it in objective-c, even the swift part. Just when using it is a app target with a swift source the compiler complains of any type we try to import into swift that it has Undefined symbols for architecture arm64: "nominal type descriptor for.

So we managed to nail down the problem and reproduce it, it seams to be related to setting a custom EXPORTED_SYMBOLS_FILE. See more below.

We have come so far! So any help would be appreciated.

So what have we done?

  • cleaned out all the public headers to not include other headers but pre declare the types
  • enable modules and we can see it creates the module map file correctly
  • A nasty problem we had was that the Include of non-modular header inside framework module this was because our public header folder had the same name as the target we where building objective c - Include of non-modular header inside framework module - Stack Overflow

Now the problem remains that the code cannot be used in swift, we can do @import OurFramework; in objective-c and access both swift and objective-c types in the framework.
However in swift when doing import OurFramework we get the undefined sybols issue.

Exporting symbols to file causes the error

I can reproduce the issue in a separate branch GitHub - dooZdev/mixed-swift-objc-framework at experiment/export-symbols

In short we set the EXPORTED_SYMBOLS_FILE build setting to export some symbols. This is needed. the file for us contains some regex of symbols to export. But this might be missing the once for the generated swift. Does anybody know what to put into this file?

Any clue to where to start looking would be grately appreciated. Thanks.