diff --git a/doric-cli/target/iOS/Example/AppDelegate.m b/doric-cli/target/iOS/Example/AppDelegate.m index 6944e754..2b5be8ec 100644 --- a/doric-cli/target/iOS/Example/AppDelegate.m +++ b/doric-cli/target/iOS/Example/AppDelegate.m @@ -14,17 +14,7 @@ @interface AppDelegate () @implementation AppDelegate - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - NSString *bundleName = @"__$__"; - DoricViewController *doricViewController = [[DoricViewController alloc] initWithSource:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] - alias:bundleName - extra:@""]; - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - UINavigationController *navVC = [[UINavigationController - alloc] initWithRootViewController:doricViewController]; - self.window.rootViewController = navVC; - [self.window makeKeyAndVisible]; return YES; } diff --git a/doric-cli/target/iOS/Example/SceneDelegate.h b/doric-cli/target/iOS/Example/SceneDelegate.h index b6321f23..30f72ed8 100644 --- a/doric-cli/target/iOS/Example/SceneDelegate.h +++ b/doric-cli/target/iOS/Example/SceneDelegate.h @@ -9,8 +9,5 @@ #import @interface SceneDelegate : UIResponder - -@property (strong, nonatomic) UIWindow * window; - @end diff --git a/doric-cli/target/iOS/Example/SceneDelegate.m b/doric-cli/target/iOS/Example/SceneDelegate.m index 9654750d..5e057088 100644 --- a/doric-cli/target/iOS/Example/SceneDelegate.m +++ b/doric-cli/target/iOS/Example/SceneDelegate.m @@ -1,6 +1,12 @@ #import "SceneDelegate.h" #import +#if DEBUG + +#import + +#endif + @interface SceneDelegate () @end @@ -12,13 +18,25 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op alias:bundleName extra:@""]; doricViewController.view.backgroundColor = [UIColor whiteColor]; +#if DEBUG + UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"Devkit" style:UIBarButtonItemStylePlain target:self action:@selector(onOpenDevkit)]; + doricViewController.navigationItem.rightBarButtonItem = rightBarItem; +#endif UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController]; - self.window = [[UIWindow alloc] initWithWindowScene:windowScene]; - self.window.frame = windowScene.coordinateSpace.bounds; - self.window.rootViewController = navigationController; - [self.window makeKeyAndVisible]; + UIWindow *window = [[UIWindow alloc] initWithWindowScene:windowScene]; + window.frame = windowScene.coordinateSpace.bounds; + window.rootViewController = navigationController; + [UIApplication sharedApplication].delegate.window = window; + [window makeKeyAndVisible]; } +#if DEBUG + +- (void)onOpenDevkit { + [[DoricDev instance] openDevMode]; +} + +#endif - (void)sceneDidDisconnect:(UIScene *)scene { // Called as the scene is being released by the system. @@ -54,3 +72,4 @@ - (void)sceneDidEnterBackground:(UIScene *)scene { @end + diff --git a/doric-cli/target/iOS/Podfile b/doric-cli/target/iOS/Podfile index e3bb9056..267690ce 100644 --- a/doric-cli/target/iOS/Podfile +++ b/doric-cli/target/iOS/Podfile @@ -7,4 +7,5 @@ target 'Example' do # Pods for Example pod 'DoricCore', '~>__$Version__' + pod 'DoricDevkit', '~>__$Version__' end