Skip to main content
Skip to navigation

Migrate the React Native SDK from CocoaPods to Swift Package Manager

Move the RevenueCat React Native SDK's iOS dependencies from CocoaPods to Swift Package Manager

Ask RicoChatGPTClaude

Use this guide for a React Native Community CLI app that manages its own ios/ project. React Native's Swift Package Manager (SPM) integration is experimental. Keep Expo apps on CocoaPods for now; see Expo apps. React Native doesn't yet recommend this integration for production.

⚠️CocoaPods releases end on December 2, 2026

CocoaPods trunk becomes read-only on December 2, 2026. Existing versions remain available; migrate to Swift Package Manager to keep receiving RevenueCat's native SDK updates.

Prerequisites​

  • React Native 0.88.0 or later.
  • An app that currently installs React Native Purchases through CocoaPods and is committed to version control. Keep CocoaPods installed: the conversion uses it to remove the existing integration.
  • SPM support in every React Native library with native iOS code. If spm add reports Package.swift is missing for library "<name>", follow React Native's guidance to generate one.

Run the following commands from the app root on macOS.

1. Update the RevenueCat packages​

Install react-native-purchases 11.0.0 or later, and the same version of react-native-purchases-ui if you use it. If you're upgrading from an earlier major version, apply the v11 API changes.

Don't run pod install after updating: the next step removes React Native's CocoaPods integration, and RevenueCat then comes from SPM.

2. Convert the Xcode project​

If your app manages CocoaPods through a Gemfile, run:

bundle exec npx react-native spm add --deintegrate

Otherwise, run npx react-native spm add --deintegrate.

RevenueCat autolinks from the installed npm packages. You don't need to scaffold manifests or add RevenueCat packages manually in Xcode. Remove any previous manual RevenueCat pod or framework integration for the migrated target.

3. Remove the old CocoaPods files​

If other native dependencies still need CocoaPods, follow Keeping other pods instead of this step.

Remove ios/Podfile, ios/Podfile.lock, and ios/Pods/. Remove the app-level .xcworkspace only if CocoaPods was its sole purpose; keep custom workspaces. Open the .xcodeproj, or your custom workspace. Update any scripts that still reference the deleted CocoaPods workspace.

Earlier versions of React Native Community CLI find your iOS project through its Podfile, so they can't find it once the Podfile is gone. Install the SPM-aware CLI in this app, keeping its packages at the same version:

npm install --save-dev --save-exact \
@react-native-community/cli@21.0.0-alpha.1 \
@react-native-community/cli-platform-ios@21.0.0-alpha.1 \
@react-native-community/cli-platform-android@21.0.0-alpha.1

Omit the Android package for an iOS-only app. Use your package manager's equivalent command if needed.

4. Build and verify​

npx react-native run-ios

Also build Release and validate your release archive. In your existing test environment, fetch offerings and complete a purchase. If you use RevenueCatUI, also open any paywall or Customer Center your app uses.

Commit the package-manager lockfile, Xcode project, .spm-injected.json, shared scheme, and .gitignore changes. Keep generated ios/build/ files ignored.

Keeping other pods​

Follow this section instead of step 3 if your app keeps CocoaPods dependencies that aren't part of React Native.

RN 0.88 removes directive lines from the Podfile, which can leave invalid Ruby. Before running pod install, remove leftover use_react_native! arguments, RN-only require statements, react_native_post_install calls, and references to the removed config variable. Replace min_ios_version_supported with your app's deployment target. Preserve setup required by the remaining pods.

From the ios directory, run pod install. If you use Bundler, run bundle exec pod install instead. Open the .xcworkspace. The remaining pods must not pull in another copy of React Native or RevenueCat.

Expo apps​

Keep Expo apps on CocoaPods. Expo SDK 58 adds SPM support as a preview, but common Expo libraries such as expo-router don't support SPM yet.

The PurchasesHybridCommon 20.1.0 pod that React Native Purchases 11.0.0 depends on isn't available on CocoaPods until after November 6, 2026. Until then, stay on React Native Purchases 10.x.

Troubleshooting​

Missing Swift packages after cloning​

React Native's generated packages under ios/build/ aren't committed. If Xcode reports missing packages after cloning, install JavaScript dependencies, then run this on macOS:

npx react-native spm update --yes

Reopen the project in Xcode and build again.

Next steps​

See the React Native install guide for SDK setup.

Was this page helpful?