From ccf665ee430c32e1cd2b219b8ed31ac3febd91f0 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 6 Dec 2019 11:15:08 +0800 Subject: [PATCH] feat:update iOS Project file --- target/iOS/.gitignore | 6 ++- target/iOS/Example.xcodeproj/project.pbxproj | 18 --------- target/iOS/Example/AppDelegate.h | 3 +- target/iOS/Example/AppDelegate.m | 10 ++++- target/iOS/Example/Base.lproj/Main.storyboard | 24 ------------ target/iOS/Example/Info.plist | 4 -- target/iOS/Example/SceneDelegate.m | 16 +++++--- target/iOS/Example/ViewController.h | 15 -------- target/iOS/Example/ViewController.m | 37 ------------------- 9 files changed, 23 insertions(+), 110 deletions(-) delete mode 100644 target/iOS/Example/Base.lproj/Main.storyboard delete mode 100644 target/iOS/Example/ViewController.h delete mode 100644 target/iOS/Example/ViewController.m diff --git a/target/iOS/.gitignore b/target/iOS/.gitignore index b34422b2..ae9d5b6f 100644 --- a/target/iOS/.gitignore +++ b/target/iOS/.gitignore @@ -1,3 +1,5 @@ Podfile.lock -Example.xcworkspace/* -Pods/* \ No newline at end of file +Example.xcworkspace/ +Pods/ +.idea/ +Example.xcodeproj/xcuserdata/ \ No newline at end of file diff --git a/target/iOS/Example.xcodeproj/project.pbxproj b/target/iOS/Example.xcodeproj/project.pbxproj index ed7c2247..4462a497 100644 --- a/target/iOS/Example.xcodeproj/project.pbxproj +++ b/target/iOS/Example.xcodeproj/project.pbxproj @@ -10,8 +10,6 @@ 95EDDB7EAB47A65821DBC7EC /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB59FE64F1D814FD13C71BB2 /* Pods_Example.framework */; }; E2F64CEF2399359C0006BD9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CEE2399359C0006BD9A /* AppDelegate.m */; }; E2F64CF22399359C0006BD9A /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CF12399359C0006BD9A /* SceneDelegate.m */; }; - E2F64CF52399359C0006BD9A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CF42399359C0006BD9A /* ViewController.m */; }; - E2F64CF82399359C0006BD9A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CF62399359C0006BD9A /* Main.storyboard */; }; E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CF92399359E0006BD9A /* Assets.xcassets */; }; E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */; }; E2F64D002399359E0006BD9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CFF2399359E0006BD9A /* main.m */; }; @@ -27,9 +25,6 @@ E2F64CEE2399359C0006BD9A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; E2F64CF02399359C0006BD9A /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; E2F64CF12399359C0006BD9A /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; - E2F64CF32399359C0006BD9A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - E2F64CF42399359C0006BD9A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - E2F64CF72399359C0006BD9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; E2F64CF92399359E0006BD9A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; E2F64CFC2399359E0006BD9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; E2F64CFE2399359E0006BD9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -84,9 +79,6 @@ E2F64CEE2399359C0006BD9A /* AppDelegate.m */, E2F64CF02399359C0006BD9A /* SceneDelegate.h */, E2F64CF12399359C0006BD9A /* SceneDelegate.m */, - E2F64CF32399359C0006BD9A /* ViewController.h */, - E2F64CF42399359C0006BD9A /* ViewController.m */, - E2F64CF62399359C0006BD9A /* Main.storyboard */, E2F64CF92399359E0006BD9A /* Assets.xcassets */, E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */, E2F64CFE2399359E0006BD9A /* Info.plist */, @@ -166,7 +158,6 @@ E2F64D07239936A70006BD9A /* src in Resources */, E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */, E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */, - E2F64CF82399359C0006BD9A /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -236,7 +227,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - E2F64CF52399359C0006BD9A /* ViewController.m in Sources */, E2F64CEF2399359C0006BD9A /* AppDelegate.m in Sources */, E2F64D002399359E0006BD9A /* main.m in Sources */, E2F64CF22399359C0006BD9A /* SceneDelegate.m in Sources */, @@ -246,14 +236,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - E2F64CF62399359C0006BD9A /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - E2F64CF72399359C0006BD9A /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/target/iOS/Example/AppDelegate.h b/target/iOS/Example/AppDelegate.h index 71de879b..c8a0f013 100644 --- a/target/iOS/Example/AppDelegate.h +++ b/target/iOS/Example/AppDelegate.h @@ -9,7 +9,6 @@ #import @interface AppDelegate : UIResponder - - +@property (strong, nonatomic) UIWindow *window; @end diff --git a/target/iOS/Example/AppDelegate.m b/target/iOS/Example/AppDelegate.m index 8c617bf6..669bece0 100644 --- a/target/iOS/Example/AppDelegate.m +++ b/target/iOS/Example/AppDelegate.m @@ -7,16 +7,22 @@ // #import "AppDelegate.h" +#import @interface AppDelegate () - @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. + NSString *bundleName = @"__$__"; + DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName]; + 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/target/iOS/Example/Base.lproj/Main.storyboard b/target/iOS/Example/Base.lproj/Main.storyboard deleted file mode 100644 index 808a21ce..00000000 --- a/target/iOS/Example/Base.lproj/Main.storyboard +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/target/iOS/Example/Info.plist b/target/iOS/Example/Info.plist index 7b6037c2..00a5d1a0 100644 --- a/target/iOS/Example/Info.plist +++ b/target/iOS/Example/Info.plist @@ -33,16 +33,12 @@ Default Configuration UISceneDelegateClassName SceneDelegate - UISceneStoryboardFile - Main UILaunchStoryboardName LaunchScreen - UIMainStoryboardFile - Main UIRequiredDeviceCapabilities armv7 diff --git a/target/iOS/Example/SceneDelegate.m b/target/iOS/Example/SceneDelegate.m index d6698dd7..887249c6 100644 --- a/target/iOS/Example/SceneDelegate.m +++ b/target/iOS/Example/SceneDelegate.m @@ -1,16 +1,20 @@ #import "SceneDelegate.h" +#import @interface SceneDelegate () - @end @implementation SceneDelegate - - - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + UIWindowScene *windowScene = (UIWindowScene *) scene; + NSString *bundleName = @"mcd"; + DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName]; + doricViewController.view.backgroundColor = [UIColor whiteColor]; + 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]; } diff --git a/target/iOS/Example/ViewController.h b/target/iOS/Example/ViewController.h deleted file mode 100644 index 131f2547..00000000 --- a/target/iOS/Example/ViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ViewController.h -// Example -// -// Created by pengfei.zhou on 2019/12/5. -// Copyright © 2019 pengfei.zhou. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/target/iOS/Example/ViewController.m b/target/iOS/Example/ViewController.m deleted file mode 100644 index 87327211..00000000 --- a/target/iOS/Example/ViewController.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// ViewController.m -// Example -// -// Created by pengfei.zhou on 2019/12/5. -// Copyright © 2019 pengfei.zhou. All rights reserved. -// - -#import "ViewController.h" -#import - -@interface ViewController () -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.view.backgroundColor = [UIColor whiteColor]; - NSString *bundleName = @"__$__"; - NSString *path = [[NSBundle mainBundle] bundlePath]; - NSString *demoPath = [path stringByAppendingPathComponent:@"src"]; - NSString *fullPath = [demoPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.js",bundleName]]; - NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil]; - DoricPanel *panel = [DoricPanel new]; - [panel.view also:^(UIView *it) { - it.width = self.view.width; - it.height = self.view.height - 88; - it.top = 88; - [self.view addSubview:it]; - }]; - [self addChildViewController:panel]; - [panel config:jsContent alias:bundleName]; -} - - -@end