I am trying to build a framework which contains both ObjC and Swift code (this is a repackaging of existing code). I'm modelling my approach on GitHub - armadsen/mixed-swift-objc-framework: Shows how to mix Swift and Objective-C code inside a framework target, except I have a lot more code to deal with. It works reasonably well so far, adding code to it works, but I'm blocked by a problem with the generation of the ObjC header for the Swift code. At the step generating this header (MyFramework/MyFramework-Swift.h), I get this error :
error: Clang dependency scanner failure: While building module 'MyFramework' imported from MyFramework-0ab317d8.input:1:
In file included from :1:
In file included from /Users/glaurent/Developer/MyFramework/MyFramework/MyFramework.h:57:
/Users/glaurent/Developer/MyFramework/MyFramework/LSUniversalBase/include/SomeRandomHeader.h:14:9: fatal error: 'MyFramework/MyFramework-Swift.h' file not found
/Users/glaurent/Developer/MyFramework/MyFramework/LSUniversalBase/include/SomeRandomHeader.h:14:9: note: did not find header 'MyFramework-Swift.h' in framework 'MyFramework' (loaded from '/Users/glaurent/Library/Developer/Xcode/DerivedData/MyFramework-fqnakdemtwsvsubsnfeqyslrvhtt/Build/Products/Debug-iphoneos')
MyFramework-0ab317d8.input:1:1: fatal error: could not build module 'MyFramework'
Several ObjC headers include MyFramework-Swift.h, and obviously since it's not there yet it can't find it, but why does generating the ObjC Swift header needs to look into the existing headers ? Of course this doesn't happen in an app project. The only way I have found to unlock this is to change the name of the imported Swift header to something else (import <MyFramework/Custom-MyFramework-Swift.h>) with the Custom-MyFramework-Swift.h being even empty, it just needs to exist. Then the header will be properly generated, and I can copy it in place of Custom-MyFramework-Swift.h.
I have tried to create an empty MyFramework-Swift.h file in the appropriate DerivedData folder, but that doesn't work, the same error persists.
Any ideas ?