Created
September 30, 2018 23:28
-
-
Save ikhsanalatsary/6573592c41b0613fec6be24f739472d2 to your computer and use it in GitHub Desktop.
ifdef in Swift
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: URL | |
#if DEBUG | |
jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil) | |
#else | |
jsCodeLocation = CodePush.bundleURL() | |
#endif | |
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