Sanniv Khare 6 min read

React Native CLI 21.1 init uses SwiftPM: what changes, tested

React Native CLI 21.1 init uses SwiftPM: what changes, tested

@react-native-community/cli 21.1.0, published on 1 December 2026, changes what init does on a Mac: for React Native 0.87 and later it now sets the iOS app up with Swift Package Manager instead of CocoaPods. If you need CocoaPods, add --skip-spm. If your CI script passes --install-pods true, it now fails before creating anything; add --skip-spm to keep the old behaviour. We diffed the CLI packages 21.0.0 and 21.1.0, then created and built a React Native 0.88.1 app both ways on our M1 lab Mac (macOS 15.7.3, Xcode 26.2, Node 24.22.3, CocoaPods 1.17.0). Both apps built and ran in the iOS Simulator. One thing did not survive: the Podfile that the SwiftPM path leaves behind is no longer valid Ruby.

Why we did this: our banking-style client apps are React Native CLI projects on CocoaPods, and from today the CocoaPods trunk stops taking new podspecs, per the CocoaPods trunk plan. New modules and sample apps we create from now on start from whatever init gives us, so we wanted to know exactly what that is.

What changed in the CLI source

The whole change sits in commands/init of @react-native-community/cli, plus two new exports in cli-config-apple. cli-platform-ios is unchanged between 21.0.0 and 21.1.0.

init.js in CLI 21.0.0 and 21.1.0, side by side

In 21.1.0, init looks for the SwiftPM setup script before it falls back to CocoaPods.

A new file, init/spm.js, decides between the two paths:

  • isSpmExpected is true on macOS when --skip-spm is not set and the React Native version is at least 0.87.0 (SPM_MINIMUM_REACT_NATIVE_VERSION).
  • findSpmSetupScript resolves react-native/scripts/setup-apple-spm from the new project. It returns nothing on Linux or Windows, with --skip-spm, with --skip-install, or with --install-pods true.
  • runSpmSetup runs that script as add --deintegrate --yes, the same thing as npx react-native spm add --deintegrate. Because --deintegrate calls pod deintegrate, CocoaPods still has to be installed: the CLI looks for the project’s bundled CocoaPods first, then the system one, and installs it if neither is there.
  • assertNoSpmConflict throws when --install-pods true is passed without --skip-spm for a React Native 0.87+ template.

If the SwiftPM setup fails, init does not stop: it warns, finishes the project and prints the command to retry. With --skip-install it prints npx react-native spm add --deintegrate as a step to run after you install dependencies. We saw exactly that text in our --skip-install run.

The flags, before and after

  • No flags: 21.0.0 asked “Do you want to install CocoaPods now?” and ran pod install on yes. 21.1.0 runs the SwiftPM setup and leaves you with an .xcodeproj and no .xcworkspace.
  • --skip-spm: new. Gives you the 21.0.0 behaviour.
  • --install-pods true: in 21.1.0 this is an error unless you also pass --skip-spm.
  • --install-pods false: still skips pod install, but the SwiftPM setup runs anyway.
  • --skip-install: no dependencies, no SwiftPM setup yet; the run instructions print the command for later.
  • React Native older than 0.87: CocoaPods as before. With a custom --template the version check and the conflict error are skipped, but the SwiftPM setup still runs if the new project’s react-native package ships scripts/setup-apple-spm.

What we ran

Each command ran once, from an empty folder, with React Native 0.88.1:

# default: Swift Package Manager
npx @react-native-community/cli@21.1.0 init SpmInit \
  --version 0.88.1 --skip-git-init --pm npm

# the old way: CocoaPods
npx @react-native-community/cli@21.1.0 init PodInit \
  --version 0.88.1 --skip-git-init --pm npm \
  --skip-spm --install-pods true

# what an old CI script does
npx @react-native-community/cli@21.1.0 init Conflict \
  --version 0.88.1 --skip-git-init --pm npm --install-pods true

The third command stopped after 9 seconds with exit code 1, and the folder stayed empty:

Terminal output: the --install-pods true error from CLI 21.1.0

Real output from our M1 lab Mac. The fix is to add --skip-spm, or drop --install-pods.

What the SwiftPM project looks like

After the default init, the ios folder held SpmInit.xcodeproj, a ReactNativeSPM folder (an .xcconfig and scripts), build/generated and build/xcframeworks, and the Podfile. There was no .xcworkspace, no Pods folder and no Podfile.lock. The project file gained three local package references (build/generated/autolinking, build/generated/ios and build/xcframeworks) and links the React, ReactNativeDependencies and hermesvm frameworks. A record of everything the script added is kept in SpmInit.xcodeproj/.spm-injected.json; npx react-native spm deinit uses it to undo the change.

The new ios/.gitignore keeps the generated parts out of git:

# SPM: auto-generated at build time (do not commit)
Package.resolved
build/generated/
build/xcframeworks/
.build/

So you open the .xcodeproj, not a workspace. The run instructions the CLI prints say the same thing.

The Podfile left behind is broken

React Native 0.88.1’s setup-apple-spm.js strips React Native from the Podfile by deleting every line that mentions use_react_native!, use_native_modules! or prepare_react_native_project!. The template calls use_react_native!( across several lines, so the arguments stay behind without their call:

target 'SpmInit' do

    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

ruby -c on that file reports syntax error, unexpected '[' at the :path line. The SwiftPM build does not read the Podfile, so the app still builds. It bites later: someone adds a pod and runs pod install, or a tool parses the Podfile. If you stay on SwiftPM with 0.88, delete the Podfile, or remove the target block’s leftover lines.

React Native 0.89 handles this differently. In the 0.89.0-rc.4 package, --deintegrate runs pod deintegrate and keeps the Podfile as it is (“The Podfile is kept”), so npx react-native spm deinit followed by pod install takes you back to CocoaPods. React Native 0.89.0 final is planned for 7 December; we cover the app-file changes in React Native 0.88 to 0.89, in order.

Both apps build and run

We built each app once for the Simulator in Release, from empty derived data:

  • SwiftPM app: clean Release build 42 s, SpmInit.app 42,880 KB.
  • CocoaPods app: clean Release build 47 s, PodInit.app 41,488 KB.
  • init itself: 223 s for the SwiftPM path and 199 s for the CocoaPods path, both including npm install and Ruby gems, so most of that is network.

These are single runs on one Mac, not benchmarks. For repeated clean builds of both paths, see our React Native 0.88 SwiftPM vs CocoaPods build-time comparison.

The default SwiftPM app and the --skip-spm CocoaPods app running in the iOS Simulator

Both apps on an iPhone 17 Pro Simulator (iOS 26.3): React Native 0.88.1 with Hermes, the same screen either way.

The SwiftPM build log had more compiler warnings than the CocoaPods one, mostly umbrella-header notes from the prebuilt React headers (“umbrella header for module ‘React’ does not include header …”). They did not stop the build.

What to change in your setup

  1. CI that creates apps: replace --install-pods true with --skip-spm --install-pods true if you need CocoaPods, or remove it to get SwiftPM.
  2. Pin the CLI version in scripts (@react-native-community/cli@21.1.0), so the next minor does not change your template under you. 22.0.0-alpha.1 shipped the same day.
  3. Native modules: a library without SwiftPM support will not link into the SwiftPM app. Check each one, or keep that app on --skip-spm for now. Existing pods keep installing after today; the CocoaPods plan says read-only trunk “will not break builds”, but new versions of a pod can no longer be published there.
  4. On 0.88 with SwiftPM: delete or fix the leftover Podfile.
  5. Open the .xcodeproj, and update any script that builds with -workspace.

Sources: npm tarballs of @react-native-community/cli, cli-config-apple and cli-platform-ios 21.0.0 and 21.1.0; react-native 0.88.1 and 0.89.0-rc.4 (scripts/setup-apple-spm.js); the CocoaPods trunk read-only plan.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.