React Native app purely in Swift

后端 未结 6 688
生来不讨喜
生来不讨喜 2020-12-24 03:42

I created my first react native app using the following command.

react-native init PropertyFinder

This created a project for ios in

6条回答
  •  情书的邮戳
    2020-12-24 04:20

    This actually works for me:

    import Foundation
    
    import UIKit
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
      var window: UIWindow?
      var bridge: RCTBridge!
    
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let jsCodeLocation: URL
    
        jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index.ios", fallbackResource:nil)
        let rootView = RCTRootView(bundleURL: jsCodeLocation, moduleName: "REPLACE_WITH_YOUR_PROJECT_NAME", initialProperties: nil, launchOptions: launchOptions)
        let rootViewController = UIViewController()
        rootViewController.view = rootView
    
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = rootViewController
        self.window?.makeKeyAndVisible()
    
        return true
      }
    }
    

提交回复
热议问题