Adding and Updating Swift Package Products with Xcode

In Xcode 13, adding and updating Swift packages and their package products has become more obscure than previous releases. This article will show you how to add a Swift package to an iOS project, then add another package product from the previously installed Swift package.

Adding a Swift Package

To add a new Swift package to your project, navigate to the Package Dependencies (<YOUR_PROJECT> > Package Dependencies) screen and click the +.

Navigate

At the top right of the new window, enter the URL of the Swift package and click Add Package.

Search Package

You can also select a package from the Recently Used, Collections, or Source Control Accounts categories.

Next, select the package products that are relevant to your project and click Add Package.

Select Product

You will now notice that the Swift package has been added to your projectin the Package Dependencies tab.

Package Added

Updating Package Products

When selecting the package products from a Swift package, it's like that you will only select the products that are relevant to your project at the time of installation. However, you may need to add another package product as your app continues to grow and mature.

To add another package product from a previously installed Swift package, navigate to the Frameworks, Libraries, and Embedded Content of your target under the General tab (<YOUR_APP_TARGET> > General > Frameworks, Libraries, and Embedded Content) and click the +.

Target Frameworks

Using the search bar or via scrolling, find and select the package product you want to include and click Add.

Additional Libraries

You will now notice the selected library or framework has been added to the list with the other embedded package products.

Updated Libraries

Now you're all set to start using the newly installed package in your project and can implement that sexy new feature! 😋

If you found this article helpful, be sure to share it with a friend, coworker, or on social media so it can help others too 😉

Share on Twitter