> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from CocoaPods to Swift Package Manager

> Move a native iOS app from CocoaPods to Swift Package Manager.

Swift Package Manager (SPM) is the recommended way to install the Primer iOS SDK in a native iOS app. This guide moves your app from CocoaPods to SPM.

CocoaPods Trunk accepts no new pods or versions from 2 December 2026. Versions already on Trunk keep installing, and your current builds keep working. You only stop getting new Primer versions through Trunk.

> [!NOTE]
>
> This guide is for native iOS apps. React Native apps keep using CocoaPods. See [React Native installation](https://primer.io/docs/sdk/react-native/v2.x.x/installation.md).

## Before you start

List the Primer pods in your `Podfile`. You need this list in step 2.

| Pod | What it adds |
| - | - |
| `PrimerSDK` | The Primer iOS SDK |
| `Primer3DS` | 3D Secure |
| `PrimerKlarnaSDK` | Klarna |
| `PrimerNolPaySDK` | NOL Pay |
| `PrimerStripeSDK` | ACH via Stripe |
| `PrimerIPay88MYSDK` | iPay88 |

Also note your `PrimerSDK` version. You can find it in `Podfile.lock`.

## Step 1. Remove the Primer pods

1. Open your `Podfile`.
2. Delete the line for each Primer pod in the table above.
3. Delete any `post_install` code that refers to Primer targets, such as `PrimerSDK` or `Primer3DS`.
4. If your `Podfile` still has other pods, run `pod install`.
5. If no pods are left, run `pod deintegrate`. This removes CocoaPods from your Xcode project.

## Step 2. Choose the version

The version depends on the Primer pods in your list.

### Only PrimerSDK, with or without Primer3DS

Use your `PrimerSDK` version, for example `2.53.1`. You can use the **Up to Next Major Version** rule. From `PrimerSDK` 2.28.0, the package includes 3D Secure, so you don't add it separately. On an older version, also add `https://github.com/primer-io/primer-sdk-3ds-ios` as a separate package, as described on the [3D Secure page](https://primer.io/docs/payment-services/3d-secure/get-started.md).

### Klarna, NOL Pay, ACH via Stripe or iPay88

SPM cannot make a library optional. So `PrimerSDK` has a separate version for each of these libraries. That version adds the library for you.

Use the **Exact Version** rule. Enter your `PrimerSDK` version followed by the suffix for your library:

| Library | Suffix |
| - | - |
| `PrimerKlarnaSDK` | `-3ds-klarna` |
| `PrimerNolPaySDK` | `-3ds-nolpay` |
| `PrimerStripeSDK` | `-3ds-stripe` |
| `PrimerIPay88MYSDK` | `-3ds-ipay88` |

For example, for Klarna with `PrimerSDK` 2.53.1, enter `2.53.1-3ds-klarna`. The `-3ds-nolpay`, `-3ds-stripe` and `-3ds-ipay88` versions exist from `PrimerSDK` 2.54.0, so on an older version, move to 2.54.0 or later first.

Follow these rules:

* Don't add the library as a separate package. The version with the suffix already includes it, and adding both is unreliable.
* Always use **Exact Version**. With **Up to Next Major Version**, SPM picks the version without the library.
* When you update `PrimerSDK`, change the version by hand. Keep the same suffix.
* Each version includes one library. No version includes two. If your app needs two of these libraries, contact [Primer support](https://primer.io/docs/support) before you move.

## Step 3. Add the package in Xcode

1. In Xcode, select **File > Add Package Dependencies**.
2. Paste `https://github.com/primer-io/primer-sdk-ios` into the search field.
3. Under **Dependency Rule**, choose the rule and version from step 2.
4. Select **Add Package**.
5. Add the `PrimerSDK` product to your app target, then select **Add Package**.

## Step 4. Build and test

1. Build and run your app.
2. In the Project navigator, check the version under **Package Dependencies**. If you use a library, the version ends with its suffix.
3. Make a test payment with each payment method you offer.

## Common errors

### Duplicate symbols

**Cause**: Your app has the Primer pods and the Primer package at the same time.

**Solution**: Remove every Primer pod from your `Podfile`, then run `pod install` again. In Xcode, select **Product > Clean Build Folder**, then build again.

### A payment method is missing

**Cause**: SPM resolved the `PrimerSDK` version without your library. This happens when the rule is not **Exact Version**, or when the version has no suffix.

**Solution**:

1. Select your project, then open **Package Dependencies**.
2. Double-click `primer-sdk-ios`.
3. Set the rule to **Exact Version** and enter the version with the suffix, for example `2.53.1-3ds-klarna`.
4. Select **File > Packages > Resolve Package Versions**, then build again.

## Stay on CocoaPods for now

If you can't move yet, add the Primer spec repo at the top of your `Podfile`:

```ruby RUBY theme={"dark"}
source 'https://github.com/primer-io/primer-sdk-ios-specs.git'
source 'https://cdn.cocoapods.org/'
```

Native apps can use the spec repo for a limited time. This route is deprecated, so plan your move to SPM.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.