Dependency Managers: CocoaPods, Carthage and Swift Package Manager

ProfilePicture of Andres Canal
Andres Canal
Senior Full-stack Mobile Developer
Diagram of dependencies in an application
Originally published on Jul 30, 2018Last updated on Jan 17, 2024

Key Takeaways

What is the difference between Swift Package Manager and CocoaPods?

To highlight some distinctions, Swift Package Manager is a decentralized dependency manager, while CocoaPods is centralized. Notably, CocoaPods can only be run on macOS, while Swift Package Manager is compatible with both macOS and Linux. Another important distinction worth mentioning is that Swift Package Manager is written in Swift, whereas CocoaPods is developed using Ruby.

Can I use Swift Package Manager with CocoaPods?

Yes, you can use Swift Package Manager with CocoaPods. CocoaPods is commonly employed to manage dependencies in iOS and macOS projects, as its unique approach helps to organize and integrate libraries into Xcode projects. On the other hand, Swift Package Manager is crafted as a native dependency manager specifically for Swift projects, providing a more seamless integration within the Swift ecosystem.

Is CocoaPods still used in 2023?

Yes, CocoaPods is still being used in 2023. CocoaPods provides a dedicated space to store metadata for all available libraries, which enables you to adopt a centralized approach and simplifies library searches. What’s more, CocoaPods is sponsored by major companies like Capital One, contributing to its continued popularity as a preferred dependency manager.

Is CocoaPods better than SPM?

SPM was lacking in features when it first came up, but it quickly caught up with CocoaPods and Carthage. Nowadays, being the Swift native option, SPM is a reliable choice as a package manager. If you have a legacy project that works with CocoaPods or Carthage, there is no reason not to stick to these tools. However, if you are starting a new project, Swift Package Manager would be the way to go.