How do I migrate from Cocoapods to SPM?

If you are looking to migrate your iOS or macOS project from CocoaPods to Swift Package Manager (SPM), follow these steps to ensure a smooth transition:

  1. Remove CocoaPods:

    First, you'll want to remove your existing CocoaPods setup. This includes deleting the Podfile, Podfile.lock, and Pods directory from your project.

  2. Add the Swift Package:

    Next, add the required Swift Packages to your project using Xcode. Go to File > Swift Packages > Add Package Dependency, then enter the repository URL of the package you’d like to add.

  3. Update Import Statements:

    Replace the import statements in your source files to use the Swift packages instead of the CocoaPods libraries.

  4. Clean Up:

    Finally, clean up your project by resolving any deprecated or unused code associated with CocoaPods.

Here's an example of how you can add a package. Replace `https://github.com/user/repo.git` with your desired package URL:

git@github.com:user/repo.git

migration CocoaPods Swift Package Manager SPM iOS development macOS development