Xcode How to add a package from Swift package manager

Below are the steps to add a new package to your project from Swift package manager with Xcode.

Open the project to which you want to add the package in Xcode.

Go to your Navigator window in Xcode.

Select the target where you want to add the new package.

Right-click it and select the Add Packages option.

Enter the URL for the package you want to add in the “Search” field of the “Add Package Dependency” dialogue box, or choose a package from the “Recently Updated” or “Popular” sections.

For this example, we will add the following package: https://github.com/apple/example-package-playingcard

Paste the git URL from the Git repository to the input box:


and click the Add Package button after selecting the package.

Select the package, target it in the next window, and click the Add Package button.

The package will be added to your project, and you will be able to use its features in your code immediately.

The target which is added will be displayed in the Navigator pane at the bottom of Project’s pane: