77
88import UIKit
99
10- #if HELLOWORLD_USE_APPDELEGATE
11-
12- import React
13- import React_RCTAppDelegate
14- import ReactAppDependencyProvider
15-
16- @main
17- class AppDelegate : UIResponder , UIApplicationDelegate {
18- var window : UIWindow ?
19-
20- var reactNativeDelegate : ReactNativeDelegate ?
21- var reactNativeFactory : RCTReactNativeFactory ?
22-
23- func application(
24- _ application: UIApplication ,
25- didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ? = nil
26- ) -> Bool {
27- let delegate = ReactNativeDelegate ( )
28- let factory = RCTReactNativeFactory ( delegate: delegate)
29- delegate. dependencyProvider = RCTAppDependencyProvider ( )
30-
31- reactNativeDelegate = delegate
32- reactNativeFactory = factory
33-
34- #if DEBUG
35- let devMenuConfiguration = RCTDevMenuConfiguration (
36- devMenuEnabled: true ,
37- shakeGestureEnabled: true ,
38- keyboardShortcutsEnabled: true
39- )
40- reactNativeFactory? . devMenuConfiguration = devMenuConfiguration
41- #endif
42-
43- window = UIWindow ( frame: UIScreen . main. bounds)
44-
45- factory. startReactNative (
46- withModuleName: " HelloWorld " ,
47- in: window,
48- launchOptions: launchOptions
49- )
50-
51- return true
52- }
53- }
54-
55- class ReactNativeDelegate : RCTDefaultReactNativeFactoryDelegate {
56- override func bundleURL( ) -> URL ? {
57- #if DEBUG
58- RCTBundleURLProvider . sharedSettings ( ) . jsBundleURL ( forBundleRoot: " index " )
59- #else
60- Bundle . main. url ( forResource: " main " , withExtension: " jsbundle " )
61- #endif
62- }
63- }
64-
65- #else
66-
6710@main
6811class AppDelegate : UIResponder , UIApplicationDelegate {
6912 func application(
@@ -73,5 +16,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7316 true
7417 }
7518}
76-
77- #endif
0 commit comments