Module dependency cycle errors in Xcode 26

I just updated to Xcode 26 and some of my Swift Packages have been getting strange build errors that I have not been able to resolve. When I try to build my Swift Package in Xcode I get the following error

Module dependency cycle: 'UIKit.swiftmodule -> <Private SPM Module>.swiftmodule -> SafariServices.swiftmodule -> UIKit.swiftmodule'

It seems like it is related to the change in Xcode 26 that states "Swift explicit modules will be the default mode for building all Swift targets". I see that you can disable this with the build setting SWIFT_ENABLE_EXPLICIT_MODULES=NO, but I don't see a way to do this in Package.swift, as you can't include value assignments like this .define("SWIFT_ENABLE_EXPLICIT_MODULES=NO").

Our private SPM repos use CI/CD and so we need to be able to build them independently of any use in a project. I would appreciate any help on fixing our Swift Package builds in Xcode 26, thanks!

Do you have a reduced version of your Swift package that maintains the overall structure and imports that we could look at? Or if there's nothing proprietary in the package and you're willing to share it, that would be helpful too. In either case, please do so in a bug report, and then post the FB number here so I can follow up on it.

— Ed Ford,  DTS Engineer

Hey Ed, thanks for replying! I tried to create a minimally reproducible example with some barebones packages and wasn't able to see the error. I then tried to remove all of the source code from the two packages where I was seeing the error and no longer get the build error. I'll try to do it piecewise to see exactly when I start getting the error and hopefully fix it or at least it can be more instructive in a bug report.

Module dependency cycle errors in Xcode 26
 
 
Q