Find a package
You can find a small selection of curated packages on Swift.org‘s Packages page.
For a more complete library, the Swift Package Index hosts a large number of packages for you to explore.
Add a package
In Xcode, go to File → Add Package Dependencies...
In the search field in the upper right, enter your package URL. This is usually a GitHub repository URL, like https://github.com/apple/swift-markdown
.
Select your package.
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.
Click Add Package.
Done! Yes, it‘s that simple.
Add 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 and Libraries.
Click the + (plus) below the list.
Select your package in the list, and click Add.
Update packages
Update a single package
Find your package under Package Dependencies in the Project Navigator.
Control-click (right-click) the package and select Update Package.
Update all packages
Control-click (right-click) Package Dependencies in the Project Navigator.
Select Update to Latest Package Versions.
Remove packages
Remove from a single target
Select the target you want to remove your package from in the Project Editor.
In the General tab, scroll down to Frameworks and Libraries.
Click the − (minus) below the list.
Confirm by clicking Delete.
Remove from project (all targets)
Select your project in the Project Editor.
In the Package Dependencies tab, select the package you want to remove.
Click the − (minus) below the list.
Confirm by clicking Remove.
— Alex