Post

Replies

Boosts

Views

Activity

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: // FrameworkOne @objc public class Thing: NSObject { &#9;&#9;public override init() {} &#9;&#9;@objc &#9;&#9;public func doSomething() {} } // FrameworkTwo @objc public class Thing: NSObject { &#9;&#9;public override init() {} &#9;&#9;@objc &#9;&#9;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: #import <Foundation/Foundation.h> @import FrameworkOneObjC; @import FrameworkTwoObjC; @interface Example : NSObject @end @implementation Example (void) example { &#9;&#9;Thing *thing = [[Thing alloc] init]; } @end Then I'm seeing this build error: '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.
44
1
24k
Aug ’20