SPM (Swift Package Manager) is a powerful tool for modern Apple developers. Compared to CocoaPods or Carthage, it’s deeply integrated into Xcode and extremely easy to use — adding, removing, and updating Swift packages is usually seamless.
However, I occasionally run into Xcode fetch errors when trying to add or update a Swift package in my project. And the larger the project, the more frequently this seems to happen.
What’s strange is that if I remove all existing packages, everything works again — which suggests the issue is likely with Xcode itself rather than the packages.
My workaround is simple and reliable:
Instead of relying on Xcode’s UI, I resolve dependencies manually via terminal:
cd your/project/path
xcodebuild -resolvePackageDependencies
That’s it — ever since I started doing this, I haven’t encountered a single fetch error.