Xcode 27: spike in "Class X is implemented in both" warnings

Anyone else seeing a lot more "Class X is implemented in both ..." warnings on Xcode 27 than on Xcode 26? Same source, same flags, the count goes from a handful to a couple thousand, and some now correlate with real crashes (cast failures, missing protocol conformances) instead of the usual harmless first-wins behavior.

Is this a known change in Swift 6.4 / Xcode 27? Is there a new flag I should be passing? Any suggestions welcome.

Answered by DTS Engineer in 894585022

I’m not aware of anything specific that would cause Xcode 27 beta to produce more of these problems than previous versions of Xcode. However, Xcode is a big chunk of code, and each major release has a bazillion changes, so it’s not a huge surprise that you’re seeing this.

If this were indicative of an Xcode problem then I’d be inclined to spend time digging into exactly what changed. However, that doesn’t seem warranted given that these are your classes. The solution is to fix your build setup so that only one copy of each class is present in any given process. Typically that involves moving the implementation of the class into a framework so that all users of the class can import that framework.

Now, as you work on that change it’s possible that you might uncover something that Xcode 27 beta is doing wrong. If so, lemme know, because uncovering weird issues like this is the whole reason we have a beta seed program.

Good luck!

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Are the classes involved system classes? Or your classes?

instead of the usual harmless first-wins behavior

It’s a common misconception that this warning is benign. In reality, it can cause all sorts of weird and hard-to-debug problems, especially for code that exploits the dynamic nature of the Objective-C and Swift runtimes. If it weren’t for compatibility concerns, I’d be advocating that we make this a trap rather than a runtime warning.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

These are all our classes. I said harmless because we could mostly get away with it, and that made us lazy and we never fixed them unless they caused crashes, which the sometimes did. But you’ll be happy to hear that it kind of feels like compatibility has gone out the window for this latest update. And that’s actually fine, I was just wondering if there was any known change that might have caused this in the tools somewhere.

I’m not aware of anything specific that would cause Xcode 27 beta to produce more of these problems than previous versions of Xcode. However, Xcode is a big chunk of code, and each major release has a bazillion changes, so it’s not a huge surprise that you’re seeing this.

If this were indicative of an Xcode problem then I’d be inclined to spend time digging into exactly what changed. However, that doesn’t seem warranted given that these are your classes. The solution is to fix your build setup so that only one copy of each class is present in any given process. Typically that involves moving the implementation of the class into a framework so that all users of the class can import that framework.

Now, as you work on that change it’s possible that you might uncover something that Xcode 27 beta is doing wrong. If so, lemme know, because uncovering weird issues like this is the whole reason we have a beta seed program.

Good luck!

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Xcode 27: spike in "Class X is implemented in both" warnings
 
 
Q