@@ -4,18 +4,36 @@ import React_RCTAppDelegate
44import ReactAppDependencyProvider
55
66@main
7- class AppDelegate : RCTAppDelegate {
8- override func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ? = nil ) -> Bool {
9- self . moduleName = " reactnative "
10- self . dependencyProvider = RCTAppDependencyProvider ( )
11-
12- // You can add your custom initial props in the dictionary below.
13- // They will be passed down to the ViewController used by React Native.
14- self . initialProps = [ : ]
15-
16- return super. application ( application, didFinishLaunchingWithOptions: launchOptions)
7+ class AppDelegate : UIResponder , UIApplicationDelegate {
8+ var window : UIWindow ?
9+
10+ var reactNativeDelegate : ReactNativeDelegate ?
11+ var reactNativeFactory : RCTReactNativeFactory ?
12+
13+ func application(
14+ _ application: UIApplication ,
15+ didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ? = nil
16+ ) -> Bool {
17+ let delegate = ReactNativeDelegate ( )
18+ let factory = RCTReactNativeFactory ( delegate: delegate)
19+ delegate. dependencyProvider = RCTAppDependencyProvider ( )
20+
21+ reactNativeDelegate = delegate
22+ reactNativeFactory = factory
23+
24+ window = UIWindow ( frame: UIScreen . main. bounds)
25+
26+ factory. startReactNative (
27+ withModuleName: " reactnative " ,
28+ in: window,
29+ launchOptions: launchOptions
30+ )
31+
32+ return true
1733 }
18-
34+ }
35+
36+ class ReactNativeDelegate : RCTDefaultReactNativeFactoryDelegate {
1937 override func sourceURL( for bridge: RCTBridge ) -> URL ? {
2038 self . bundleURL ( )
2139 }
0 commit comments