import React import React_RCTAppDelegate import ReactAppDependencyProvider import UIKit class SceneDelegate: RCTDefaultReactNativeFactoryDelegate, UIWindowSceneDelegate { var window: UIWindow? var reactNativeFactory: RCTReactNativeFactory? func scene( _ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions ) { guard let windowScene = scene as? UIWindowScene else { return } dependencyProvider = RCTAppDependencyProvider() reactNativeFactory = RCTReactNativeFactory(delegate: self) (UIApplication.shared.delegate as? AppDelegate)?.reactNativeFactory = reactNativeFactory window = UIWindow(windowScene: windowScene) #if DEBUG let devMenuConfiguration = RCTDevMenuConfiguration( devMenuEnabled: true, shakeGestureEnabled: true, keyboardShortcutsEnabled: true ) reactNativeFactory?.devMenuConfiguration = devMenuConfiguration #endif reactNativeFactory?.startReactNative( withModuleName: "PlatformComponentsExample", in: window, connectionOptions: connectionOptions ) } func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { RCTLinkingManager.scene(scene, openURLContexts: URLContexts) } func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { RCTLinkingManager.scene(scene, continue: userActivity) } override func bundleURL() -> URL? { #if DEBUG RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") #else Bundle.main.url(forResource: "main", withExtension: "jsbundle") #endif } }