Xcode Requires A Lot of Data for Swift Package Resolution

Xcode on mobile data after resolving packages once: 45MB required

This picture shows one of the weird annoyances with Xcode and Swift packages.

One package resolution step swallowed 45MB of my data.

You’ve likely heard it elsewhere: when iOS developers need to work with Swift packages and Xcode but have a shoddy internet connection, tough luck! Xcode will fail to build because it’s “Resolving Packages” step inevitably fails.

Today, our internet was out for the first half of the day, so I had to tether to my iPad to actually get Xcode to work at all. Rebasing was the death blow to the package cache; but even after this initial package fetching, I managed to amass a throughput of almost 200MB in maybe 3 hours of development work.

I would like to think that a SwiftPM-managed project, where you could check in the .swiftpm/ directory if you need, would perform better in that regard.

Does Xcode not grab a shallow clone, maybe?

The packages in this project:

  • Sparkle
  • sindresorhus/Preferences
  • glebd/CocoaFob
  • 9 packages of my own making with almost no commit history worth mentioning

I could see how fetching the whole of Sparkle can amount to more data than the others.