Skip to content

Declare the SwiftPM name in package.json - #778

Merged
janicduplessis merged 2 commits into
appandflow:mainfrom
chrfalch:fix/swiftpm-config-name
Sep 28, 2026
Merged

janicduplessis merged 2 commits into
appandflow:mainfrom
chrfalch:fix/swiftpm-config-name

Conversation

@chrfalch

Copy link
Copy Markdown
Contributor

Summary

React Native's SwiftPM autolinker now takes a library's Swift name from its podspec when package.json declares no name (react/react-native#58290). The podspec for this library is named react-native-safe-area-context. The library product in Package.swift is named ReactNativeSafeAreaContext. Because the two names differ, a new React Native app built with SwiftPM fails package resolution:

product 'react-native-safe-area-context' required by package 'autolinking' target 'AutolinkedAggregate' not found in package 'react-native-safe-area-context'

This PR adds "swiftpmConfig": { "name": "ReactNativeSafeAreaContext" } to package.json. React Native reads this field before it looks at the podspec, so the autolinker now asks for the product that Package.swift declares. Package.swift does not change, so the module name and the header import prefix stay the same.

A new test in src/__tests__/swiftpm-test.ts checks that swiftpmConfig.name in package.json matches the library product name in Package.swift. The file header comment now describes where the name comes from.

Test Plan

yarn jest src/__tests__/swiftpm-test.ts

Before the package.json change, the new test failed (Expected: "ReactNativeSafeAreaContext", Received: undefined). After the change, the result is Tests: 5 passed, 5 total.

eslint, prettier --check, and yarn validate:typescript pass on the changed files.

@janicduplessis

Copy link
Copy Markdown
Collaborator

Thanks!

@janicduplessis
janicduplessis merged commit afaa1e4 into appandflow:main Sep 28, 2026
3 checks passed
@chrfalch

Copy link
Copy Markdown
Contributor Author

Thanks for the quick merge, @janicduplessis :)

@janicduplessis

Copy link
Copy Markdown
Collaborator

No problem! We are reworking our release process so might take a little bit more time to be out on npm since I want to use this one to test it out.

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