Skip to content

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

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

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-clameta-claBot 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
@facebook-github-toolsfacebook-github-toolsBot 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

Copy link
Copy Markdown

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

@meta-codesyncmeta-codesyncBot added the Merged This PR has been merged. label Aug 19, 2026
@meta-codesync

Copy link
Copy Markdown

@cipolleschi merged this pull request in 0c86952.

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

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.p: ExpoPartner: ExpoPartnerShared with MetaApplied 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

@chrfalch@cipolleschi