This was necessary because we had to use the newest iOS SDK, which had an issue with react-native, which was only fixed with the newest versions. The move to new architecture has been hellish, but all appears to work. It requires more patches, and it shows which packages are currently maintained poorly. This goes especially for react-native-track-player. We're using a fork right now, but in order to make that work, we had to switch to pnpm.
49 lines
1.2 KiB
Swift
49 lines
1.2 KiB
Swift
import UIKit
|
|
import React
|
|
import React_RCTAppDelegate
|
|
import ReactAppDependencyProvider
|
|
|
|
@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: "Fintunes",
|
|
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
|
|
}
|
|
}
|