Skip to content

fix(ios): define RCT_NEW_ARCH_ENABLED in Package.swift - #805

Merged
janicduplessis merged 1 commit into
appandflow:mainfrom
chrfalch:safe-area-new-arch-define
Nov 3, 2026
Merged

janicduplessis merged 1 commit into
appandflow:mainfrom
chrfalch:safe-area-new-arch-define

Conversation

@chrfalch

@chrfalch chrfalch commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

SwiftPM builds do not get the new-architecture TurboModule code. Package.swift defines only DEBUG and NDEBUG. ios/RNCSafeAreaContext.mm puts -getTurboModule: inside #ifdef RCT_NEW_ARCH_ENABLED, so SwiftPM builds leave it out.

This PR adds .define("RCT_NEW_ARCH_ENABLED", to: "1") to cSettings and cxxSettings. The define has no condition, because the SwiftPM target already compiles the Fabric sources with no condition. The guarded blocks have no #else branch, so no old-architecture code is lost.

To check: run yarn jest src/__tests__/swiftpm-test.ts. All 5 tests should pass. The contract test now expects both defines.

Checked with https://github.com/schiewe/react-native-swiftpm-new-arch-repro, in a Release build for the iOS simulator:

  • Before: nm finds no -[RNCSafeAreaContext getTurboModule:] in the app binary.
  • After: nm finds -[RNCSafeAreaContext getTurboModule:], and the build log shows -DRCT_NEW_ARCH_ENABLED=1.

Follow-up to react-native-community/discussions-and-proposals#994 (comment).

@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

@chrfalch is attempting to deploy a commit to the appandflow Team on Vercel.

A member of the Team first needs to authorize it.

@janicduplessis
janicduplessis merged commit 2468ed0 into appandflow:main Nov 3, 2026
3 of 4 checks passed
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