feat:update init script

This commit is contained in:
pengfei.zhou 2019-12-09 14:10:45 +08:00
parent 9ba32487c6
commit ce35ebc40e
2 changed files with 4 additions and 3 deletions

View File

@ -117,8 +117,9 @@ function initiOS(path, name) {
return console.error(err);
}
copyFolder(`${targetiOSPath}`, `${path}`, () => {
const mainFiles = `Example/ViewController.m`
fs.writeFileSync(`${path}/${mainFiles}`, fs.readFileSync(`${targetiOSPath}/${mainFiles}`).toString().replace(/__\$__/g, name))
['Example/SceneDelegate.m', 'Example/AppDelegate.m'].forEach(e => {
fs.writeFileSync(`${path}/${e}`, fs.readFileSync(`${targetiOSPath}/${e}`).toString().replace(/__\$__/g, name))
})
console.log(`Create Doric iOS Project Success`)
})
})

View File

@ -7,7 +7,7 @@ @interface SceneDelegate ()
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
UIWindowScene *windowScene = (UIWindowScene *) scene;
NSString *bundleName = @"mcd";
NSString *bundleName = @"__$__";
DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName];
doricViewController.view.backgroundColor = [UIColor whiteColor];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController];