Xcode 12 different definitions in different modules build error

In the Xcode 12 betas I'm seeing an issue with importing Swift modules with @objc annotations.

Given two Swift modules which expose classes of the same name:

Code Block
// FrameworkOne
@objc
public class Thing: NSObject {
public override init() {}
@objc
public func doSomething() {}
}


Code Block
// FrameworkTwo
@objc
public class Thing: NSObject {
public override init() {}
@objc
public func doSomethingElse() {}
}


And if I have imported both of the frameworks into an ObjC file and interact with the classes in either of them:

Code Block
#import <Foundation/Foundation.h>
@import FrameworkOneObjC;
@import FrameworkTwoObjC;
@interface Example : NSObject
@end
@implementation Example
- (void) example
{
Thing *thing = [[Thing alloc] init];
}
@end


Then I'm seeing this build error:
Code Block
'Thing' has different definitions in different modules; first difference is definition in module 'FrameworkOne.Swift' found method name 'doSomething'
But in 'FrameworkTwo.Swift' found method name 'doSomethingElse'


Is this expected behaviour? If so, is there any way to opt out?

In my case FrameworkOne & FrameworkTwo are external dependencies, and I'm unable to change the names of the classes.
Post not yet marked as solved Up vote post of mike-velu Down vote post of mike-velu
21k views

Replies

Same issue for me, we have got 2 different pods which contain same class names.
From Xcode 12 beta 5, the project can't compiled and gives same build error:
'X' has different definitions in different modules; first difference is definition in module 'Y' found method name 'Z'

I think that build process has been changed at Xcode 12 beta 5. I'm looking for a solution.
Also seeing this issue in Xcode 12 beta 6. Reported a bug (FB8591101). To me this seems to be a regression as separate modules should be allowed to contain same type names in Swift and this worked in previous Xcode versions.
Following this ticket, since I have the same problem and I can't figure it out.



Following this, this bugs me since the first xcode12 beta, it was working fine in xcode11.
Following this, I'm still having this issue with XCode 12.0 Beta 6. Is there any official response from Apple regarding this? If it's deemed as an expected behaviour in the future, we need to plan a big code update...
Is there anything new regarding this?
I have this issue with Alamofire and Kingfisher.
Still having this issue with XCode12 GM
I can confirm that this is still happening on Xcode 12 GM seed.
Issue is still present on the released non-beta Xcode 12.
Same here.
I had to force rename one of third-party class name...
Same here. The only workaround I've found is to rename one of the realisations
Hi! I had the same issue. I solve it by doing this:
  1. Close Xcode

  2. On command line write pod deintegrate and then pod install

  3. Open Xcode and problem should be solved.

Sorry for my english :p
Hope it helps!
The issue reproduces in Xcode 12.2 beta 2 (12B5018i).
Following this ticket, since I have the same problem and I can't figure it out.
this happens only in new build system when use legacy its not happen
Same exception for me and project could not be compiled.

XCode 12 conflicted frameworks;
  • HGPlaceholders

  • Material

'CollectionView' has different definitions in different modules; first difference is definition in module 'HGPlaceholders.Swift' found property name 'collectionViewLayout'