Adding and Updating Products from already added Swift Package with XCode

Santosh Botre
3 min readApr 24, 2023


In XCode, updating Swift packages and adding package products has become a hidden gem.

This article will show you how to add a Swift package to an iOS project and another packaged product from the previously installed Swift package.

Adding a Swift Package

To add a new Swift package to our project, navigate to the File menu and then the submenu Add Packages…

It presents the Apple Swift Packages screen.

At the top right of the window, enter the URL of the Swift package.

Once it found the respective Swift Package, set the Dependency Rule to be Up to Next Major Version.

Then, select Add Package.

Choose the Firebase products that you want to be installed in your app.

Next, select the package products “FirebaseAnalytics” that are relevant to our project and click Add Package.

When selecting the package products from a Swift package, it’s like we will only select the products that are relevant to our project at the time of installation

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

We are free to use the “FirebaseAnalytics” by importing “Firebase” into our project.

Updating Package Products

After a few days, Project needs to add a few other products which we haven’t selected in the initial phase.

Now we wanted to add the FirebaseDatabase dependency to our project.

I again followed the same step of Adding a Swift Package as mentioned above and guess what?

I ended up here where it says, The project already contains this package dependency.

But when I try to import FirebaseDatabase it throws an error.

When selecting the package products from a Swift package, it’s like you will only select the products that are relevant to your project at the time of installation.

However, we may need to add another package product as our app continues to grow and mature.

To add another package product from a previously installed Swift package, navigate to the Project, Target, Build Phases, and Link Binary with Libraries of your target under the Build Phases tab.

<APP_TARGET> > Build Phases > Link Binary with Libraries and click the +.

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

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

Now you’re all set to start using the newly installed product from the already installed package in your project and can start using it! 😋



Santosh Botre

Take your time to learn before develop, examine to make it better, and eventually blog your learnings.