From bde2fe25ae959c9ec1cbe0fc6a05a2e6e9fe5fb2 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 26 May 2026 22:13:12 -0700 Subject: [PATCH] =?UTF-8?q?Remove=20sourceURL(for:)=20override=20=E2=80=94?= =?UTF-8?q?=20superseded=20by=20bundleURL()=20after=20legacy=20arch=20remo?= =?UTF-8?q?val?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sourceURLForBridge: method will be removed from RCTBridgeDelegate in https://github.com/facebook/react-native/pull/56831 due to the RCT_REMOVE_LEGACY_ARCH clean up. Then the override no longer overrides anything and fails Swift compilation. bundleURL() — already present below — is the replacement API on RCTReactNativeFactoryDelegate. This change depends on https://github.com/facebook/react-native/pull/56974 --- template/ios/HelloWorld/AppDelegate.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/template/ios/HelloWorld/AppDelegate.swift b/template/ios/HelloWorld/AppDelegate.swift index 0d3565bd..01d31f82 100644 --- a/template/ios/HelloWorld/AppDelegate.swift +++ b/template/ios/HelloWorld/AppDelegate.swift @@ -34,9 +34,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate { +#if !RCT_REMOVE_LEGACY_ARCH + // Required by `RCTBridgeDelegate` until the legacy architecture is fully + // removed. On newer React Native versions this symbol no longer exists, so + // the override is compiled out via SWIFT_ACTIVE_COMPILATION_CONDITIONS. override func sourceURL(for bridge: RCTBridge) -> URL? { self.bundleURL() } +#endif override func bundleURL() -> URL? { #if DEBUG