Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Swift Package Manager (SPM) and cocoapods together in one project?

I have an existing project which uses Cocoapods, but I would like to switch to SPM; unfortunately I still have dependencies which aren't available in SPM.

Now I would like to move as many dependencies as possible over to SPM and keep the others in Cocoapods as long as necessary - is this possible? Having both, Cocoapods and SPM?

like image 228
swalkner Avatar asked May 12 '20 06:05

swalkner


People also ask

Can you use both SPM and CocoaPods?

Cocoapods + SPM 🚀 Now your library supports both cocoa pods and SPM.

Can we use swift package manager with CocoaPods?

Even though CocoaPods is very easy to use, adding dependencies to a project using the Swift Package Manager has become the easier option thanks to Xcode's improved support for the SPM.


1 Answers

I just tried CocoaPods with SPM on my iOS project and it works fine.
I'm adding Firebase and other Google libs using CocoaPods and the rest using Swift Package Manager.

When adding SPM dependency, put checkmark on your project(s) and not on the Pods project.

Xcode 11.5,
CocoaPods 1.9.3.

like image 51
Pavel Alexeev Avatar answered Sep 21 '22 18:09

Pavel Alexeev