Callstack Nov 25, 2025

Integrating Swift Package Manager with React Native Libraries

Article Summary

Mike Grabowski from Callstack shows how React Native developers can finally use Swift Package Manager alongside CocoaPods. The catch? Your entire iOS project needs dynamic frameworks.

React Native has relied on CocoaPods for years, but Apple's Swift Package Manager is the future. Since React Native 0.75, there's been a way to integrate SPM packages through the spm_dependency helper. This article walks through using both remote and local SPM packages in your React Native libraries.

Key Takeaways

Critical Insight

React Native developers can now bridge the CocoaPods and SPM ecosystems, though adopting dynamic frameworks is mandatory and may impact performance or binary size.

The article includes a patch workaround and reveals how the integration manipulates Xcode project files under the hood using CocoaPods' Xcodeproj gem.

About This Article

Problem

React Native libraries couldn't use local Swift packages in monorepos. The spm_dependency helper only worked with remote Git URLs, so developers had to find workarounds to handle local packages.

Solution

Callstack fixed spm_dependency to handle local packages alongside remote ones. The update uses File.exist() checks to create XCLocalSwiftPackageReference objects for local paths instead of XCRemoteSwiftPackageReference.

Impact

React Native libraries can now consume local Swift packages in monorepos with relative path resolution. You'll need to patch node_modules until React Native 0.84 comes out officially.

Recent from Callstack

Related Articles