Testing Apple’s integrated Swift Package Manager (SPM)

Editor at Sage
Sage Developer Blog
3 min readJun 12, 2020

by Roger Pintó, Mobile Software Developer, Sage

Last WWDC (Worldwide Developers Conference, 2019), Apple integrated Swift Package Manager (SPM) into Xcode 11, creating quite a stir in the iOS developer community. It’s the first dependency manager officially provided and supported by Apple, and now, it’s built right into Xcode, making it easier than ever to manage your dependencies.

After it was released, I couldn’t resist the temptation to try it myself and I migrated my dependencies from Cocoapods to SPM on my personal projects. A few months later, I can tell that I love the simplicity of it and the fact that Xcode automatically keeps your dependencies up to date without you having to worry about it. And in case you are wondering, of course you can opt-out this feature or even allow updating just up to the next major version.

As part of the iOS Accounting team at Sage, and being a large team, we opted for Carthage as our dependency manager, mainly because of the fast build times it provides us after the dependencies are checked out. However, it does have its drawbacks, and these are usually around performance — sometimes we need to update some dependencies, but you can end up waiting more than 10 minutes for it to action.

But now, there’s a new player in town, and we need to ask ourselves how will it perform against Carthage, and if we can shift to SPM at Sage?

To answer these questions, we must compare it to our current dependency manager. We all know the positives and negatives of using Carthage since there are many articles available about it (check for example this Medium post), even comparing it with SPM (check for example this article in Codementor), but I didn’t find the one that really interested me and focused on performance.

Then, when we updated Amplitude (one of our third-party dependencies) to their latest version (5.0.0), a build error appeared, and it was the perfect opportunity to get my hands dirty and compare the products.

I’ve tried both approaches: building the whole project using just Carthage, and Carthage with the Amplitude framework in SPM.

The results we found…

Conclusion

Unfortunately, it’s not suitable for us to use SPM right now, as it’s not efficient on a large project with 4 more developers having to wait extra time to compile, but it can still be a good option on a personal or small project with a single developer. And with WWDC 20 happening in less than a month, we can’t wait to see the improvements Apple will surprise us with…

--

--