Ready for Swift Package Manager?

This script helps you to find out.

Image for post
Image for post

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:

cd {project-root}
curl https://raw.githubusercontent.com/StatusQuo/spmready/master/main.swift -o spmready.swift
chmod +x spmready.swift
./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.

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.

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.

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 🤷‍♀️.

Written by

Mobile & Cloud Developer. iOS & Firebase Fanboy.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store