From fcb86cca4e1975e0a094b4594e756b29fb1232c4 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Tue, 26 Aug 2025 03:39:49 -0700 Subject: [PATCH] add SWIFT_ENABLE_EXPLICIT_MODULES to xcode 26 (#53457) Summary: XCode 26 introduces building explicit swift modules turned on (SWIFT_ENABLE_EXPLICIT_MODULES). This breaks building with precompiled binaries. This commit fixes this by adding a step when not building from source where we explicitly set the `SWIFT_ENABLE_EXPLICIT_MODULES` flag to `NO`. ## Changelog: [IOS] [FIXED] - Added setting SWIFT_ENABLE_EXPLICIT_MODULES=NO when using precompiled to support Xcode 26 Pull Request resolved: https://github.com/facebook/react-native/pull/53457 Test Plan: ```bash npx react-native-community/cli init MyApp --version nightly --skip-install cd MyApp yarn cd ios bundle install RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install ``` Build above app with Xcode 26 and verify that it no longer fails Reviewed By: motiz88 Differential Revision: D81025367 Pulled By: cipolleschi fbshipit-source-id: 1db7c4d7de07d62f43b355aa784d7d9de478023c --- packages/react-native/scripts/react_native_pods.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 707b0f0bd69..e9f5a89fd92 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -497,6 +497,13 @@ def react_native_post_install( ReactNativePodsUtils.updateOSDeploymentTarget(installer) ReactNativePodsUtils.set_dynamic_frameworks_flags(installer) ReactNativePodsUtils.add_ndebug_flag_to_pods_in_release(installer) + + if !ReactNativeCoreUtils.build_rncore_from_source() + # In XCode 26 we need to revert the new setting SWIFT_ENABLE_EXPLICIT_MODULES when building + # with precompiled binaries. + ReactNativePodsUtils.set_build_setting(installer, build_setting: "SWIFT_ENABLE_EXPLICIT_MODULES", value: "NO") + end + SPM.apply_on_post_install(installer) if privacy_file_aggregation_enabled