Skip to content

docs(ios-prebuild): correct how SwiftPM consumes the prebuilt React headers - #58007

Open
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/prebuild-docs-swiftpm-headers
Open

docs(ios-prebuild): correct how SwiftPM consumes the prebuilt React headers#58007
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/prebuild-docs-swiftpm-headers

Conversation

@chrfalch

Copy link
Copy Markdown
Collaborator

Summary:

ios-prebuild/__docs__/README.md said React.framework's headers-spec layout
"is what both CocoaPods and SwiftPM consume". That is right for CocoaPods and
misleading for SwiftPM: React.xcframework is not a member of the Swift package
graph at all, so nothing on the SwiftPM side reads its framework module map.

What actually happens is a staging step on the consumer side —
stageReactHeadersTarget in scripts/spm/flavored-frameworks.js copies
React.framework/Headers into ReactHeadersTarget/include/React and rewrites
framework module React to a plain module React, which is then vended as the
ReactHeaders target. The prebuild output is still the source of those headers,
which is why the sentence was nearly right; the consumption path is what differs.

Says so, and keeps the CocoaPods half explicit about FRAMEWORK_SEARCH_PATHS so
the two paths read as the distinct mechanisms they are.

Changelog:

[Internal] - Clarify that SwiftPM consumes the prebuilt React headers through a
staged ReactHeaders target, not through the XCFramework's module map

Test Plan:

Docs only. Verified against scripts/spm/generate-spm-package.js, whose generated
ReactNative manifest declares exactly three headers-only products and no runtime
binaryTarget, and against stageReactHeadersTarget, which does the copy and the
module-map rewrite only after Debug and Release are asserted to expose identical
headers. Prettier clean — the file was formatted before this change and still is.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

## Summary:

`ios-prebuild/__docs__/README.md` said `React.framework`'s headers-spec layout
"is what both CocoaPods and SwiftPM consume". That is right for CocoaPods and
misleading for SwiftPM: `React.xcframework` is not a member of the Swift package
graph at all, so nothing on the SwiftPM side reads its framework module map.

What actually happens is a staging step on the consumer side —
`stageReactHeadersTarget` in `scripts/spm/flavored-frameworks.js` copies
`React.framework/Headers` into `ReactHeadersTarget/include/React` and rewrites
`framework module React` to a plain `module React`, which is then vended as the
`ReactHeaders` target. The prebuild output is still the source of those headers,
which is why the sentence was nearly right; the consumption path is what differs.

Says so, and keeps the CocoaPods half explicit about `FRAMEWORK_SEARCH_PATHS` so
the two paths read as the distinct mechanisms they are.

## Changelog:

[Internal] - Clarify that SwiftPM consumes the prebuilt React headers through a
staged `ReactHeaders` target, not through the XCFramework's module map

## Test Plan:

Docs only. Verified against `scripts/spm/generate-spm-package.js`, whose generated
`ReactNative` manifest declares exactly three headers-only products and no runtime
`binaryTarget`, and against `stageReactHeadersTarget`, which does the copy and the
module-map rewrite only after Debug and Release are asserted to expose identical
headers. Prettier clean — the file was formatted before this change and still is.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 19, 2026
@chrfalch
chrfalch requested a review from cipolleschi August 19, 2026 07:13
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 19, 2026
@meta-codesync

meta-codesync Bot commented Aug 19, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D116598314.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants