Do you use CocoaPods? It seems CocoaPods doesn't work with Explicitly built modules which are turned on in Xcode 26. If you enable it in Xcode 16 then it also breaks there.
I received a similar error after loading a personal project into Xcode 26 beta 4 for the first time. The specific error was:
"Compilation search paths unable to resolve module dependency: '_Testing_Foundation'"
After reading this thread, I turned off "Explicitly Built Modules" in the target and that fixed the issue.
One user mentioned that after setting that build setting to NO, to fix SPM build problems and then turn it back on. I tried that and I still got the error message.
So, my conclusion is that this is a bug in the compiler/linker that will soon be fixed in future betas. I'd create a FB, but I am not sure how to replicate it in a simple project.
I am also building an app with Xcode 26 beta 5, but I am unable to resolve the import dependency of opencv2. I can build it by turning off explicitly built modules, but I am unable to use some of the app's functions, so I would like to know if there is another way to fix this.