Skip to content

Instantly share code, notes, and snippets.

@ybonnetain
Last active October 1, 2022 09:14
Show Gist options
  • Save ybonnetain/7b3e510050447ae52c0f8d6dd741d9d4 to your computer and use it in GitHub Desktop.
Save ybonnetain/7b3e510050447ae52c0f8d6dd741d9d4 to your computer and use it in GitHub Desktop.
#import <React/RCTBridgeDelegate.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@end
@implementation AppDelegate
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"MyApp"
initialProperties:@{}];
rootView.backgroundColor = [UIColor whiteColor];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = rootView;
[self.window makeKeyAndVisible];
return YES;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment