Swift Package Manager
React Native 0.87 introduced a Swift Package Manager (SwiftPM) build path for
iOS. It is optional: CocoaPods remains the supported iOS installation path for
react-native-nitro-geolocation.
Current Compatibility
Do not run npx react-native spm in an app that installs this package yet.
The React Native 0.87 SwiftPM autolinker requires every native dependency to
resolve through a compatible Package.swift, either shipped by the library or
generated from a supported podspec. The required react-native-nitro-modules
peer dependency does not currently ship one.
This package and Nitro Modules also contain a mixed Swift, Objective-C++, and
C++ target with Swift/C++ interop. React Native's generated SwiftPM scaffold
cannot safely translate that target. Running npx react-native spm scaffold
does not make this combination supported.
Supported RN 0.87 Installation
Install both JavaScript packages normally, then keep the CocoaPods integration for iOS:
Use pod install instead of bundle exec pod install when the app does not
check in a Gemfile. Open the generated .xcworkspace and rebuild the native
app.
Android setup is unchanged. The iOS dependency-manager choice does not affect the package's JavaScript API.
Avoid Unsupported Workarounds
Do not:
- disable iOS autolinking for
react-native-nitro-modules; - add an empty manifest or use a generated scaffold for these mixed-language
Nitro targets in
node_modules; - split the generated Nitro target into independent Swift and C++ targets;
- link the same React or Nitro native symbols through both CocoaPods and SwiftPM.
These workarounds can pass package resolution while producing missing native registrations, duplicate symbols, or configuration-specific linker failures.
When SwiftPM Becomes Available
SwiftPM-only installation can be documented as supported after all of these conditions are met:
react-native-nitro-modulespublishes an official SwiftPM product.react-native-nitro-geolocationpublishes a manifest or binary package that preserves Nitro's Swift/C++ interop settings.- Debug and Release builds pass on both an iOS simulator and a physical-device archive with React Native 0.87.
- The app can run Modern,
/compat, and background registration checks without CocoaPods products in the link graph.
Until then, choose CocoaPods for apps that use this package. React Native's 0.87 changelog and the upstream Nitro Modules repository are the source of truth for the two prerequisite implementations.
