From 9707ad9dfba656a9ccbe486a4d4ede3b1e9fc280 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 1 Feb 2025 16:25:54 -0800 Subject: [PATCH] Create UI in didFinishLaunching. --- iOS/AppDelegate.swift | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 6a4a25cc2..f684fccb3 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -20,12 +20,14 @@ var appDelegate: AppDelegate! @UIApplicationMain final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, UnreadCountProvider { - private var window: UIWindow? + var window: UIWindow? private var bgTaskDispatchQueue = DispatchQueue.init(label: "BGTaskScheduler") private var waitBackgroundUpdateTask = UIBackgroundTaskIdentifier.invalid private var syncBackgroundUpdateTask = UIBackgroundTaskIdentifier.invalid + private var sceneCoordinator: SceneCoordinator? + var syncTimer: ArticleStatusSyncTimer? var shuttingDown = false { @@ -118,10 +120,18 @@ final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationC syncTimer!.update() #endif - window = UIWindow(frame: UIScreen.main.bounds) - - return true + // Create window and UI. + let window = UIWindow(frame: UIScreen.main.bounds) + self.window = window + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let rootSplitViewController = storyboard.instantiateInitialViewController() as! RootSplitViewController + sceneCoordinator = SceneCoordinator(rootSplitViewController: rootSplitViewController) + rootSplitViewController.coordinator = sceneCoordinator + window.rootViewController = rootSplitViewController + window.makeKeyAndVisible() + + return true } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {