Xcode and Swift Package Manager fails to resolve locked Package.resolved modules when switching between git branches while Xcode app is open.
Tested on Xcode 12.0.1 and 12.2 beta 2 (12B5025f)
Occurs about 75% of the time.
Sample app can be found here: https://github.com/raymondk-nf/LocalSwiftPackageTest
Follow Swift forum thread here: "Missing package product" error for all local Swift Packages when switching git branches
- Open Test projected in either Xcode 12.0.1 and 12.2 beta 2 or higher
- Wait for Xcode to download and resolved all SPM packages.
- Then switch to another branch with “git checkout Test --“ while leaving Xcode app open.
- Observe more often than not, Xcode has altered the “Package.resolved” file unexpectedly.
- If not, go back to master branch and repeat steps 2-4
On master branch, SPM Apollo module is set to version "0.34.1” in Package.resolved. On Test branch, SPM Apollo module is set to version "0.28.0" in Package.resolved. After switching to Test branch, I expect Xcode to resolve Apollo module version to “0.28.0” but instead it seems as if Xcode did not recognize that Package.resolved file changed during branch switching.