How to add a local Swift Package in XCode

A step by step guide on adding a local Swift Package through the Swift Package Manager in XCode.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 10/05/2023 at 14:43
Last Updated on 10/05/2023 at 15:31
<p>Two flowers that represent Swift and Xcode with the text "Swift Package Manager Add Local Package" beneath it.</p>

A step by step guide on adding a local Swift Package through the Swift Package Manager in XCode.

SubscribeHow to add a Swift Package Manager package dependency

The following tutorial is based off the process that we carried out as part of our GraphQL Swift tutorial which uses a Local Package to allow you to make GraphQL API calls.

How to make a GraphQL API call in Swift

Step One: Add a New Package

<p>A screenshot of Xcode highlighting how you can access the Package Dependencies of a project. We have also highlighted the + button that allows you to add a new package.</p>

Navigate to the Package Dependencies of your project and click +.

Step Two: Add Local Package

<p>A screenshot of Xcode showing the Swift Package Manager modal. We have highlighted the "Add Local.." button that appears at the bottom of the modal.</p>

In the modal that appears, select Add Local...

Step Three: Select Local Folder

<p>A screenshot showing the finder window that appears allowing you to select and add a local package. We have highlighted the PokeAPI folder that was generated in Step Eleven.</p>

In the modal that appears, navigate to the location of the folder of the local package.

Select it and click Add Package.

Step Four: Confirm

<p>A screenshot of the confirmation modal that appears when you add a local package. Click add package on the bottom right to finish this step.</p>

In the confirmation modal that appears, click Add Package.

The local package will now be added to the projects package dependencies.

<p>A screenshot of Xcode showing how the PokeAPI now appears as a package dependency in the project.</p>

Looking to learn more about things you can do with Swift or XCode ?

Search our blog to find educational content on learning how to use Swift or XCode.

Search our Blog

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.
SubscribeContact UsVisit our BlogView our ServicesView our 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