Ready for Swift Package Manager?

Humi
Humi
Sep 9 · 3 min read

This script helps you to find out.

This year Swift Package Manager has made a huge step forward. Integrated into Xcode 11 it is no longer a Package Manager that you should ignore. While some of the Open Source Projects you are using have problems adopting to Swift Package Manager, because of (at the moment) missing features like Resource handling, others are already fully supported. But how to figure out which Libraries are ready to migrate?

I wrote a small script that does the whole work for you if you are using Cocoapods.

4 simple steps:

1. In Terminal go to your project root folder

cd {project-root}

2. Download latest script version

curl https://raw.githubusercontent.com/StatusQuo/spmready/master/main.swift -o spmready.swift

3. Make it executable

chmod +x spmready.swift

4. Run

./spmready.swift

Hope this helps 😊

Where do we go from here?

Do I really need all my dependencies ready before I consider a migration? No, you can start migration today.

Mixed Migration aka Early Adopter

Imagine you have your cocoapods and SwiftPackages imported by Swift Package Manager at the same time. This is a good idea and works pretty well as long as the pods don’t depend on a SwiftPackage and vice versa. You also have to make some other considerations. If you are using Swift Package Manager now, you will be part of the early adopters that are switching early. This doesn’t mean that Swift Package Manager is unstable at all but it needs help from us — the community. To follow its evolution, have a look at the swift forums. Nevertheless, adding the Libraries Acknowledgments gets a little bit harder. While cocoapods merges all Acknowledgments into a single file for you, Swift Package Manager doesn’t even care about you being a (bad) Copycat. Moreover, it can be possible that some libraries never will be supported by the Swift Package Manager because of its lacking community. Then maybe its time to drop this Library and replace it with one that has similar functionality. That way you put yourself in response to clean up and update your dependencies.

Sit and wait

Hey Siri remind me to check spmready for migration in one year

This is fine. Working with two Dependency Managers can be exhausting and no one can tell you how long it will take until all libraries you are using have SwiftPM support. But please consider contributing to the open-source project, you can always file an issue on Github to show that you care.

Old is gold

I have cocoa pods/Carthage. So why do I need another Swift Package Manager?!

I think SwiftPM will be the new standard dependency manager. It feels just right to have dependencies managed and viewable in your IDE. And if you really don’t ever think about migrating to the new, you probably wouldn’t click a headline like this 🤷‍♀️.

Humi

Written by

Humi

Mobile & Cloud Developer. iOS & Firebase Fanboy.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade