iosdev

Issue with SPM unable to resolve package update

New possibility, new issues.

Xcode 26.4 brought nice new usage possibility in the Package manifest.

I discovered it through lovely package resolving error when attempting “Update to Latest Package Versions”:

unexpectedly did not find the new dependency in the package graph:
sourceControl(
  identity: idensicmobilesdk-ios, 
  location: SwiftPM.SPMPackageDependency.SourceControlLocation.remote(
    SwiftPM.SPMSourceControlURL(sourceControlURL: https://github.com/SumSubstance/IdensicMobileSDK-iOS.git)), 
  requirement: 1.42.0 – Next Major, 
  traits: Set(["default"])
)

I had version 1.39.1, noticed there’s an upgrade and got such message.

As one does these days, I asked Claude what the heck is this new menace and it told me:

SDK’s Package.swift is swift-tools-version: 5.3 (no trait declarations), and the resolver in your Swift 6.1 toolchain is asking for the “default” trait that the 5.3 package can’t advertise.
It’s cache/graph desync that hits old packages when resolver state is stale.

I can’t tell if that’s correct explanation of the issue but the only solution seemed to be nuclear one: clear out all the caches and let Xcode download all dependencies again.

rm -rf ~/Library/Developer/Xcode/DerivedData/PROJECT-*
rm -rf PROJECT.xcodeproj/project.xcworkspace/xcuserdata
rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/org.swift.swiftpm

Then reopen Xcode and let it re-resolve.

It worked, so there you go.