I was having the same issue where swift build
would work, but xcodebuild
(or building within Xcode) didn't – Xcode was not fetching the packages from the registry (in my case, AWS CodeArtifact).
The solution, as described here, was to copy the contents of .swiftpm/configuration/registries.json
into MyProject.xcworkspace/xcshareddata/swiftpm/configuration/registries.json
(note that the destination swiftpm
folder doesn't start with a ".") and create a "Dependencies" package inside my workspace that requires the package from registry and add this "Dependencies" package under the "Frameworks and Libraries" on the correct target of my main project.
Reported to Apple with FB17939830.