Created
August 26, 2018 07:07
-
-
Save ikhsanalatsary/147e9f5c14e3d52de5bbced33ea76740 to your computer and use it in GitHub Desktop.
AppDelegate dengan UIApplicationMain untuk React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.swift | |
// ReactNativeSwift | |
// | |
// Created by Gabriel Lai on 26/8/18. | |
// Copyright © 2018 Facebook. All rights reserved. | |
// | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { | |
let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil) | |
let rootView = RCTRootView(bundleURL: jsCodeLocation, moduleName: "ReactNativeSwift", initialProperties: nil, launchOptions: launchOptions) | |
rootView?.backgroundColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1) | |
window = UIWindow(frame: UIScreen.main.bounds) | |
let rootViewController = UIViewController() | |
rootViewController.view = rootView | |
window?.rootViewController = rootViewController | |
window?.makeKeyAndVisible() | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment