Once-a-year Black Friday deals are coming. Read more.
Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Issue 61
May 04, 2021

Is Swift Package Manager production ready?

In other words, is it time to migrate from Carthage, CocoaPods, or maybe GIT Submodules?

A few months ago we migrated all our dependencies to make use of Swift Package Manager (SPM). We used to use GIT Submodules and never migrated to something like CocoaPods because we knew we were migrating to SPM soon, either way. It was support for resources in packages that made us decide to start the migration.

Today, we're linking around 16 local packages and several external packages through SPM. Even though it's not always great yet, we're super happy that we decided to migrate and we would definitely recommend using SPM for new projects today.

Reasons for using SPM
SPM is integrated into Xcode which is a hard to beat advantage over frameworks like CocoaPods. Its support is going to improve in the upcoming years, even this upcoming WWDC will likely bring a lot of improvements.

The fact that Swift 5.4 came with a lot of improvements proves that Apple puts serious efforts into improving SPM. You can read more about this in one of the articles I linked in this week's edition.

Today's downsides of SPM
There are still a few downsides of SPM today. It's not easy to use libraries like SwiftLint when editing single packages, which can be a downside for keeping your code quality up.

Code coverage is currently not working on Apple Silicon Macs and a few small issues can sometimes be frustrating:
- File headers are not automatically updated (It shows File.swift instead of the filename, for example)
- Creating a new file using the Unit Test template creates an Objective-C class (why?!)

These are just a few observations, but not enough for me to discourage using SPM. In the end, I feel like these issues will be solved sooner than later. Using SPM today prepares you for the future.

Would I recommend migrating today if your using CocoaPods? Maybe not yet. Maybe wait till WWDC is there and more improvements arrive. CocoaPods has quite a few nice features that aren't supported by SPM today and I can totally imagine those features make it hard to move away today.

Feel free to reach out to me on Twitter and share your opinion.

Enjoy this week's SwiftLee Weekly!

THIS WEEK'S BLOG POST

Last week, my main focus was on improving our URLSession implementation around background uploads in the Collect by WeTransfer application. I've had to dig into testing these flows and came up with a list of tips I want to share with you so you can get to results faster whenever you're implementing background tasks support in your apps.

Why you should read this: Two tips to speed up your testing flow

TWEET OF THE WEEK

A great tip by Oskar Groth for removing a shortcut you won’t be using either way and using it for refreshing the SwiftUI live Preview canvas instead!

SPONSORED

Imagine you could undo mistakes in Git with a simple keyboard shortcut, use Interactive Rebase via drag and drop or clone a repository from GitHub with a single click. Tower lets you do exactly that and so much more. Try it free for 30 days.

CURATED FROM THE COMMUNITY

CODE

I was surprised how little I knew about the method I’ve likely written the most throughout my career. Andy Ibanez gives us insights into how we can make use of the print method in different ways.
Swift Package Manager has gotten a lot of love in the last Swift release. Five Stars Blog takes us through all the changes, and as you can imagine, after reading this week’s intro, we were super happy with these changes too!
It’s an article Sarun W. wrote in 2020, but it’s super relevant as we gain more and more adoption on iOS 14. We all have our own extension methods to simplify the back bar button item, but this will replace all of those!
Not long ago, we were treated with a new Swift library, including an OrderedSet which I’ve been missing ever since Swift was released. Ole Begemann had his thoughts on how the new OrderedSet type works and decided to dive in to understand its implementation better.
I liked this article by John Sundell for multiple reasons. It shows Combine operators you might not know yet while also covering solutions to common problems when developing apps, like debouncing for performance reasons and retrying failed network requests.

MINDSET

A completely different read, not Swift related, but super interesting to realize how important our work can be. A small mistake in a configuration can lead to whole different outcomes. That perspective is something I could relate to as an app developer, and I really enjoyed reading this article.

THANK YOU

Thanks for being a SwiftLee subscriber! 
Continue your journey: