Can we replace Cocoapods with Swift Package Manager in iOS?

Viewed 1291

I want to add a new 3rd party library dependency like Alamofire in my project. Can we use it with the swift package manager?

2 Answers

As per Apple Latest updates,

Thankful to this link for clarifying the doubt b/w cocoapods and package manager : My fav link for this topic is - : https://zonneveld.dev/swift-package-manager-to-cocoapods/

Swift Package Manager is available since 2016 but wasn’t that powerful yet. Recently, a new version of Swift Package Manager is released together with Xcode 11. This new version will finally allow you to replace CocoaPods.

Apple Package Manager integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Remove CocoaPods from your project

pod deintegrate

Migrate to Swift Package Manager

After removing CocoaPods, you can use the .xcodeproj file again. Open your project, then go the menu bar and select File -> Swift Packages -> Add Package Dependency.

As far as replacing cocoapds is concerned , i think YES. Package Manager is more handy and more relevant as compared to cocoappods since in pods based project , if anything change then you need to explicitly do it but in case of package manager once you add dependency using this , XCode automatically adds the more stable and updated version to it .

Go for it , available for all the platforms iOS , tvOS , watchOS and MacOS too.

Related