Today, after Xcode 12.5 upgraded, when I try to work on my projects, Xcode keeps running "Resolve Swift Packages" every second or so, this means that it both keeps flashing the display the whole time - it never settles, and it also keeps the machine busy and eventually, Xcode becomes unusable.
This has a movie showing what my Xcode looks like tonight, the pauses in the video are caused by Xcode not responding to scrolling, since I left that thing idling while I had dinner:
tirania.org/tmp/xcode-hang.mov
This can be reproduced by downloading github.com/migueldeicaza/SwiftTerm and opening either the Swift solution or the Xcode projects.
I have submitted a bug report.
I had the same issue since updating to Xcode 12.5. However, what I discovered is opened Swift packages loop on resolving if you use a relative location for DerivedData. Try opening Xcode 12.5 preferences go to Locations and set DerivedData to default location. Problem went away for me. This is a less destructive way to solve this problem rather than deleting Xcode configuration.