Skip to content

Fix Swift imports of React Native headers with warnings as errors - #59750

Open
sorinc03 wants to merge 2 commits into
react:mainfrom
sorinc03:fix/ios-swift-import-header-warnings
Open

sorinc03 wants to merge 2 commits into
react:mainfrom
sorinc03:fix/ios-swift-import-header-warnings

Conversation

@sorinc03

@sorinc03 sorinc03 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #59730.

Complete WebSocket-provider and RedBox header nullability annotations while preserving existing nil fallbacks and optional inputs. Match NSObject's nullable isEqual: parameter in RCTReactTaggedView.

The existing legacy RCTRootView customization declaration gets declaration-local deprecation handling, without changing its signature or suppressing consumer warnings. Add scripts/test-ios-swift-headers.sh, an unsigned generic-simulator smoke build using SWIFT_TREAT_WARNINGS_AS_ERRORS=YES.

Changelog

[IOS] [FIXED] - Fix React Native header warnings that prevent Swift module imports when warnings are treated as errors

Test Plan

Reproduced both reported SwiftExplicitDependencyGeneratePcm failures on Xcode 27.1 with the issue's pinned 0.89.0-nightly-20261031-e57dcb3cc reproducer. All six affected baseline headers were byte-identical to this branch's base before staging fixes.

bash scripts/test-ios-swift-headers.sh /path/to/ReproducerApp/ios ReproducerApp /tmp/rn-swift-header-build
  • Source mode: baseline build exit 65; after staging the six fixed headers, the full unsigned app build and fresh Swift imports passed for arm64 and x86_64. Re-ran the final smoke script successfully after review.
  • Prebuilt mode: baseline build exit 65; repacked the published debug artifact with only these six headers and tested via RCT_TESTONLY_RNCORE_TARBALL_PATH. Both architectures and module imports passed; the framework binary remained byte-identical.
  • Strict compiler checks for nullable provider results and RedBox inputs failed before, passed after; dev menu enabled and disabled covered.
  • Negative control: consumer use of deprecated RCTRootView still emits the expected error, confirming the pragma does not suppress downstream warnings.
  • Regenerated the four affected Apple API snapshots with yarn cxx-api-build and Doxygen 1.16.1; all 12 snapshots pass CI-style validation. The final source smoke also recompiles RCTRedBox.mm without a nonnull warning for its intentional nil reload-controller argument.
  • Header formatting, shell syntax, and git diff --check pass.

These are actual app/compiler builds, not regex checks. Validation stages equivalent current headers into the pinned nightly; it is not a whole-checkout HEAD build or newly built precompiled XCFramework. No runtime/UI tests, complete repository suite, Release/Catalyst/device build, or public CI result is claimed. The new smoke script is not wired into CI in this patch.

@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 Nov 2, 2026
@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 Nov 2, 2026
@sorinc03

sorinc03 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the CI snapshot failure by regenerating the four affected Apple API snapshots with the official yarn cxx-api-build command (Doxygen 1.16.1). Each delta is the intended nullable isEqual: parameter; CI-style validation now passes all 12 snapshots locally. Also preserved the existing nil reload-controller contract explicitly and reran strict nullable-contract checks plus the arm64/x86_64 source Swift-import smoke build with warnings treated as errors. The source fixture recompiles RCTRedBox.mm without the new nonnull warning. Public CI is rerunning on the follow-up commit.

This branch has not been deployed

No deployments
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. 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.

[iOS] React Native's headers fail a Swift import built with SWIFT_TREAT_WARNINGS_AS_ERRORS (nullability and deprecation warnings)

1 participant