Xcode fails to resolve locked Package.resolved file when switching git branches while Xcode app is open

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

Repro steps:

  1. Open Test projected in either Xcode 12.0.1 and 12.2 beta 2 or higher
  2. Wait for Xcode to download and resolved all SPM packages.
  3. Then switch to another branch with “git checkout Test --“ while leaving Xcode app open.
  4. Observe more often than not, Xcode has altered the “Package.resolved” file unexpectedly.
  5. 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.

@NeoNacho Filed a Radar FB8783743

Terms of Service

Privacy Policy

Cookie Policy