Question: After I create a new swift package with dependencies I call `swift package generate-xcodeproj`. If my dependencies have a new version I call `swift package update`. The new version of my dependency gets downloaded and built but Xcode now has a bad reference to the old version of the dependency. I can call `swift package generate-xcodeproj` again but this will remove any custom targets I have setup.

How do I update my swift dependencies and my Xcode project without deleting my custom targets?

Answer: 
I just stumbled upon this question and found that the solution to "How to update swift dependencies in Xcode" has probably changed now that Swift Packages have been around for a few years.

For me, the solutions was to simply go to `File` -> `Swift Packages` -> `Update to Latest Package Versions`.

[![enter image description here](https://i.stack.imgur.com/HomP2.png)](https://i.stack.imgur.com/HomP2.png)
I had an issue with CryptoSwift using Xcode 12.5. My version was 1.3.1 and the issue was fixed in 1.4.0.
I tried :

1. updating by File -> Swift Packages -> Update to Latest Package Versions.
2. xcodebuild -resolvePackageDependencies

But both did not work.

I manually went and changed target -> Swift packages -> Version rules
and Xcode automatically installed the newer version and I was out of my error.