Adding a Package dependency
In Xcode, go to File → Add Packages... OR select your project in the Project Editor, go to the Package Dependencies tab, and press the + (plus).
Enter a Package URL (e.g. a GitHub repository URL) or a search term in the search field in the upper right.
Select the package you want to add.
Select a Dependency Rule. In most cases, you probably want to set this to Up to Next Major Version.
Click Add Package.
Under Add to Target, select the target you want to add the package to. (Want to add to multiple targets? See below.)
Done! 🚀 Yes, it's that simple.
Adding a package dependency to multiple targets
Select the additional target you want to add your package to in the Project Editor.
In the General tab, scroll down to Frameworks, Libraries, and Embedded Content.
Click the + (plus), select your package in the list, and click Add.
Updating a package Dependency
Find your package under Package Dependencies in the Project Navigator
Right-click the package and select Update Package.
You can also update all package dependencies to their latest versions by right-clicking Package Dependencies and selecting Update to Latest Package Versions OR by going to File → Packages → Update to Latest Package Versions.
Removing a package dependency
Select your project in the Project Editor.
In the Package Dependencies tab, select the package you want to remove.
Click the − (minus) and then Remove.
— Alex