Swift Package Manager

Also called SPM, SwiftPM

Mentioned in
CocoaPods
Updated

What is Swift Package Manager in React Native?

Swift Package Manager is Apple’s built-in dependency manager for Swift and iOS code, integrated into Xcode and the long-term successor to CocoaPods for React Native.

Swift Package Manager (SPM) is Apple’s official tool for distributing and consuming Swift, Objective-C and C/C++ code. Packages are described by a Package.swift manifest and added from a Git URL, and Xcode resolves them natively, with no Ruby or separate install step.

For React Native developers it matters because it is where iOS dependency management is heading. Most native iOS SDKs — analytics, payments, maps — now publish SPM packages first, and some have stopped updating their CocoaPods versions. Meanwhile React Native itself and the vast majority of community libraries have historically shipped as podspecs, installed through CocoaPods.

In practice today:

  • React Native’s own build and autolinking still revolve around CocoaPods, while support for SPM is being added gradually. Check the docs for your React Native and Expo versions rather than assuming either way.
  • You can add an SPM package to your app target in Xcode and call it from your own Swift or Objective-C code, alongside your Pods.
  • Library authors wrapping an SPM-only SDK sometimes have to vendor the binary or ask for a podspec.

The common trap is Expo’s Continuous Native Generation. If ios/ is regenerated by npx expo prebuild, a package you added through Xcode’s user interface is wiped next time. Add it through a config plugin that edits the Xcode project, or keep ios/ committed.

Another misconception is that SPM replaces npm for React Native libraries. It does not: the JavaScript half of a library still comes from your package manager, and SPM only concerns the native iOS half.