How to add a Swift Package Manager package dependency

A step by step tutorial on how to add a Swift Package Manager package to an iOS XCode project. Github open-source repository included.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 07/11/2022 at 21:57
Last Updated on 08/27/2022 at 11:51
A flower that represents Swift next to a Flower that represents Xcode. Below it sits the words "Add a Swift Package Manger Dependency"

A step by step tutorial on how to add a Swift Package Manager package to an iOS XCode project, through the example of TinyConstraints. Github open-source repository included.

Download open source project

Step One: Navigate to Package Dependencies

A screenshot showing you how to navigate to the Swift Package Manager dependencies.

Select the App configuration option in the file inspector in our case its the part that has an App Logo from the file inspector with the title Starter Project. Then under Project select Starter Project and Package Dependencies.

Step Two: Add a new Package

To add a new package press the + sign under the package dependencies.

Press '+' to add a new package.

Step Three: Add your Package

A screenshot showing you how to add TinyConstraints via the search bar. It shows you how to select it from the browser and how to alter what you pull from Github.

Add the package repository url to the search bar, then select it and press Add Package.

Alternatively, if you've added it before, you can search for it - as we have searched for Tiny Constraints.

In this section you can also configure to add the latest branch or up-to a latest version.

Step Four: Add Package Products

A screenshot showing you how to select and add package products to your project.

Once XCode has resolved the package, select your desired package products and press Add Package.

Download open source project

Looking for more XCode tutorials ?

Here's a range of resources that might interest you.

How to create a SwiftLint enabled Swift Xcode ProjectHow to create a structured Xcode projectRecommended .gitignore for Swift projects in XCode

Any Questions

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.

SubscribeInquireView All PostsView All ServicesView All Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe