Skip to content

fix(ios): set swiftpmConfig.name so SwiftPM autolinking finds the ReactNativeBlobUtil product - #507

Merged
RonRadtke merged 1 commit into
RonRadtke:masterfrom
chrfalch:spm-swiftpm-config-name
Nov 9, 2026
Merged

RonRadtke merged 1 commit into
RonRadtke:masterfrom
chrfalch:spm-swiftpm-config-name

Conversation

@chrfalch

Copy link
Copy Markdown

Thank you for adding the Package.swift on master.

Problem

In a React Native 0.88.0 app in SwiftPM mode (npx react-native spm add --deintegrate --yes), master (1a602b3) fails at package resolution:

Could not resolve package dependencies: product 'react-native-blob-util' required by package 'autolinking' target 'AutolinkedAggregate' not found in package 'react-native-blob-util'.

React Native names a library's SwiftPM product with swiftpmConfig.name from its package.json. When that field is missing, it uses the podspec name, which here is the npm name react-native-blob-util. The Package.swift names the package and product ReactNativeBlobUtil, so the two names do not match.

Change

One line in package.json:

"swiftpmConfig": { "name": "ReactNativeBlobUtil" },

React Native then links the library as ReactNativeBlobUtil, which is the link folder that the Package.swift comment expects. CocoaPods builds do not read this field, so they are not affected.

Test

Fresh React Native 0.88.0 app, this library as a dependency, with the line added:

  1. npx react-native spm update links ReactNativeBlobUtil.
  2. xcodebuild … -configuration Debug -destination 'generic/platform=iOS Simulator' build prints BUILD SUCCEEDED.
  3. On an iOS 27 simulator with the new architecture (bridgeless), TurboModuleRegistry.get('ReactNativeBlobUtil') is present and ReactNativeBlobUtil.fs.exists(ReactNativeBlobUtil.fs.dirs.DocumentDir) returns true.

Without the line, step 2 fails with the error above.

npm has 1.0.0 as the newest version, and it has no Package.swift. After this change, could you publish 1.1.0?

@RonRadtke
RonRadtke merged commit 7d96751 into RonRadtke:master Nov 9, 2026
3 of 11 checks passed
RonRadtke added a commit that referenced this pull request Nov 9, 2026
The pull requests merged since 1.1.0 (#498, #499, #501, #503, #505, #507)
and the fixes from a pass over the open issues (#197, #334, #377, #384,
#390, #411/#256, #425, #486). Migration.md lists each change under 1.1.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants