Files
react-native/packages/helloworld/ios/HelloWorld/AppDelegate.swift
Erich GrahamandFacebook GitHub Bot aa98b8589b Run swift-format OrderedImports rule across fbsource [58] (#50853)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50853

Pre-run OrderedImports rule in prep for enabling across repo.
drop-conflicts

Reviewed By: adamjernst

Differential Revision: D73453458

fbshipit-source-id: d7f7bb319e04209f20dbdd03945eededc57522d5
2025-04-22 16:53:01 -07:00

56 lines
1.4 KiB
Swift

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React
import ReactAppDependencyProvider
import React_RCTAppDelegate
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()
reactNativeDelegate = delegate
reactNativeFactory = factory
window = UIWindow(frame: UIScreen.main.bounds)
factory.startReactNative(
withModuleName: "HelloWorld",
in: window,
launchOptions: launchOptions
)
return true
}
}
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}