How to update swift package imported to Xcode Project via Swift Package Manager?

Viewed 3267

I know how to create new Swift Package using Xcode I now how to add in Project Settings new Swift Package using Swift Package Manager tab

But how I can refresh it i.e. force to download updated version from github. Currently I do not have tags for versioning so I choose to use master branch

What I do currently is remove dependency and add it again in Swift Package Manager.

2 Answers

Option 1: (Xcode 13 and above)

Right-click on the package from the left navigation pan and select Update Package

Xcode 13

Option 2:

Double click on the package in the tab you mentioned and change the version to anything else. It will then recheck the remote repo. The benefit of doing this is to only update the selected package. (Also, it's better to have the current using version be set in the package.)

Option 3:

From File -> Swift Packages -> Update to Latest Package Versions

SS

If it is not added with version, i.e. through branch name, then follow the steps.

1. Clear derived data

2. Go to Xcode file-> Swift Packages -> Update to Latest Package Versions

If your remote repo is on vpn, dont forget to enable it and then update the package.

You can see the package getting checked out and added to the target.

Related