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:
And if I have imported both of the frameworks into an ObjC file and interact with the classes in either of them:
Then I'm seeing this build error:
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.
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.