Incompatibility Swift compiler/Xcode 11.4 with linked frameworks

Hi, since I updated my Xcode version to 11.4, I have a problem regarding the use of two of my frameworks together.

Here is the context :

I have an Swift application project containing a Swift framework. In this framework, I use 2 other frameworks, one in Swift (S), one in Objective-C (O).

Both of the (S) and (O) frameworks contains a class with the name (pretty tricky case, but I cannot do much about it), let's call it "MySuperClass".

With Xcode version 11.3 and prior, I had no problem using both: I use a modulemap for my Objective-C framework since I use it inside another Swift framework, I import each module and Swift class independently, and all of this is working pretty fine, I can call "MySuperClass" from both frameworks.

With Xcode version 11.4, something seems to be messed up because it tells that my module, based on framwork (O), has no member named "MySuperClass".


I try to look at which class is used when I call "MySuperClass" from framework (S), since I have no warning regarding this one, but Xcode cannot figure it out.


I had the opportunity to check the behavior when I change the class name of framework (S) and magicaly the problem was solved and my framework (O) sundenly has the member "MySuperClass".


I searched a lot for similar cases and solution, but the addition of Obj-c & Swift frameworks, containing a class with the same name, inside another framework, does not seem that common so I couldn't find anything about it nor any way to fix this.


Can it be considered as a bug with Xcode/Swift compiler that is reportable and should be fixed ?

Or have someone already met this kind of problem ?


Thanks in advance.

Answered by DTS Engineer in 414152022

Customizing module maps isn't supported by Xcode, and as you've discovered, fragile. Please see this other thread for some additional background.

Accepted Answer

Customizing module maps isn't supported by Xcode, and as you've discovered, fragile. Please see this other thread for some additional background.

Thank you for your time edford, unfortunately I already saw this generic answer and it didn't help me.


The project was in fact well configured, I solved the problem inside the code.

The class of my application framework which extended the MySuperClass object from (S) didn't have the suffixe "S".

I do not know why it was coded like that since it is not my code, neither why it worked before XCode 11.4, since it did not seem logic from the beginning, but whatever, I just needed to change the code from this :


extension MySuperClass {}


to this :


extension S.MySuperClass {}


"Fun" fact, in the extension of MySuperClass from (O), I did not have "O.MySuperClass" either, but adding it did not solve the problem.

It's great you found a way of making this work. However, as I said, providing your own module map isn't supported by Xcode 11 and is fragile, so your solution that fixes the issue right now may break again in the future. Please file an enhancement request with a description of the problem you're trying to solve with the custom module map so the Xcode team can understand your needs and create a supported solution.

Incompatibility Swift compiler/Xcode 11.4 with linked frameworks
 
 
Q