Xcode no longer supports temporarily using a local SwiftPM package?

One practice that I use a lot is to drag and drop a SwiftPM package into my project when I want to make local edits - this replaces the remote dependency with a local dependency. Then I can edit and make changes to the dependency.

When I am done, I remove that directory and Xcode would revert back to the remote package.

In Xcode 16 this feature does not seem to work anymore, and instead it offers to copy the files into the project.

Answered by Developer Tools Engineer in 791150022

Adding a file reference to an existing package into an Xcode project can still be completed in Xcode 16. And as you pointed out it will can be used to replace the remote dependency with a local dependency.

The popup button in the new files interaction panel offers 3 options:

If you select "Reference files in place" you will have the same behavior as in Xcode 15.

Can you just remove the package from the Package Dependencies tab, then add it as a local package?

That works, but two convenience features seem to be gone.

The first is that replacing a package was a matter of dragging the new package Xcode's project navigator, and it would automatically override the current definition (no need to delete) and when you were done, you could remove it, and it would automatically revert back to the configuration you had.

The workaround requires the original package definition to be entered again (was it a hash, was it a version range, was it just a branch?)

Accepted Answer

Adding a file reference to an existing package into an Xcode project can still be completed in Xcode 16. And as you pointed out it will can be used to replace the remote dependency with a local dependency.

The popup button in the new files interaction panel offers 3 options:

If you select "Reference files in place" you will have the same behavior as in Xcode 15.

Thank you so much! This is great!

no, its not the same, the files on the swiftpm arent editable.

I am not seeing the same results as Xcode 15. Instead I get a package icon without a ">" caret to expand to see the files. Any other suggestions?

Issue turned out to be that I had the package opened in a separate Xcode window. Once I closed that window, I was able to browse the files.

Xcode no longer supports temporarily using a local SwiftPM package?
 
 
Q