iOS template add devkit button
This commit is contained in:
parent
0db94701d6
commit
edd212198d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,5 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow * window;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
#import "SceneDelegate.h"
|
||||
#import <DoricCore/Doric.h>
|
||||
|
||||
#if DEBUG
|
||||
|
||||
#import <DoricDevkit/DoricDev.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -7,4 +7,5 @@ target 'Example' do
|
||||
|
||||
# Pods for Example
|
||||
pod 'DoricCore', '~>__$Version__'
|
||||
pod 'DoricDevkit', '~>__$Version__'
|
||||
end
|
||||
|
Reference in New Issue
Block a user