Member-only story

Adding a Swift Package Dependency in Xcode 13

Xcode 13 brought plenty of changes to us and one of them is the new Swift Package Collections. This changed where we add Swift packages to our projects from.

Iiro Alhonen
2 min readJun 11, 2021
Photo by Claudio Schwarz | @purzlbaum on Unsplash

The old File -> Swift Packages -> Add Package Dependency... is no longer there, and I had to spend a few minutes finding where to add it in the Xcode 13 beta 1. Hopefully this article pops up on your Google results and you don’t have to scratch you head like I did.

The Old Way

Like I mentioned, before Xcode 13 you would click on the File menu, navigate to Swift Packagessubmenu and click on Add Package Dependency... and this would open up a pop up where you could add the Swift package you want to use.

This option no longer exist so how do you add packages in Xcode 13?

The New Way

With Xcode 13, you need to add packages through the new menu they introduced with the Swift Package Collections. To find this menu, you need to navigate to your project settings where you can find a new menu for Swift Packages.

Package addition menu location

From here you can click the + button to add new packages. This will open the new Swift Package Collection view where you can add packages from collections (the Apple Swift Packages-collection will be here by default) or you can search for packages or add an external package using the URL for the package.

Swift Package Collection

One great feature here is the ‘Recently Used’ tab that will show packages that you have used in your other projects. Makes it very easy to add packages that you use often.

Here are couple of videos from WWDC 2021 that go through Swift Package Collections:

--

--

Iiro Alhonen
Iiro Alhonen

Written by Iiro Alhonen

iOS developer building cool products and nerding out about comics. Currently running my first big D&D campaign. Occasionally funny,

Responses (1)

Write a response