React Native 0.75 introduced the `spm_dependency` helper to integrate Swift Package Manager packages into React Native libraries alongside CocoaPods. This covers how to use both remote SPM packages (via URL) and local SPM packages in monorepo setups. A fix extending `spm_dependency` to support local package references is merged into main and expected in React Native 0.84, with a patch available for immediate use. The integration works by using CocoaPods' Xcodeproj gem to modify Xcode project files, creating either `XCLocalSwiftPackageReference` or `XCRemoteSwiftPackageReference` objects. A key limitation is that SPM usage currently forces the entire iOS project to use dynamic frameworks via `use_frameworks! :linkage => :dynamic`.
Table of contents
Using remote SPM dependenciesLocal SPM packages in monoreposSupporting local SPM packagesUsage in monoreposUnder the hoodConclusionSort: