Are there any drawbacks if we use other dependency Manager like cocoapods alongside SPM?

My project currently uses cocoa-pods and now I have to use one of the Apple's Framework CareKit which currently is available via SPM only.

I asked Apple Developers here about CareKit latest stable 2.0.0 unavailable via Pods and in there I asked them

Question: Can we use SPM alongside other dependency Managers like Cocoa-pods ?

Reply: Yes, cocoapods and SPM can be used together. You can include CareKit with SPM and other dependencies (like ResearchKit!) with cocoapods.

Even though they said we can use multiple Dependency manager, I want to know if there are any drawbacks or a better way to do the same.

Thanks

1 Like

I’ve got a project using both right now (because not everything is available on spm yet). It works fine. There is one issue I’ve come across - SPM and cocoa pods are not aware of each other’s packages / pods.

So if module “abc” and “xyz” both depend on another, module, “efg”, under a single package manager, and “efg” of the matching version requirements will be downloaded. If “abc” is in one package manager, and “xyz” is another, you’ll end up with two copies of “efg” in your app, possibly different version of it too. This could lead to undefined behavior and crashes.

So basically make sure the packages you download between SwiftPM and coacoapods don’t share any dependencies.

4 Likes

It’s pretty easy to add CocoaPods support to a random library, so I would suggest doing that. SPM still doesn’t support things like automatic license rendering that are usually required with OSS libraries.

1 Like