From 67c391dbba06800a3ae8b606702c250b83e4a618 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 21 Mar 2024 19:49:55 +0100 Subject: [PATCH] Integrated the FeedListCoordinator and the AppCoordinator coordinators into the AppDelegate in the App target. --- App/Sources/{ => App}/AppDelegate.swift | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) rename App/Sources/{ => App}/AppDelegate.swift (58%) diff --git a/App/Sources/AppDelegate.swift b/App/Sources/App/AppDelegate.swift similarity index 58% rename from App/Sources/AppDelegate.swift rename to App/Sources/App/AppDelegate.swift index fb1338f..e0dfd38 100644 --- a/App/Sources/AppDelegate.swift +++ b/App/Sources/App/AppDelegate.swift @@ -6,6 +6,7 @@ // Copyright © 2020 ING. All rights reserved. // +import ReviewsCoordinationKit import ReviewsFeed import UIKit @@ -13,6 +14,7 @@ import UIKit class AppDelegate: UIResponder { // MARK: Properties + var coordinator: AppCoordinator? var window: UIWindow? } @@ -26,9 +28,19 @@ extension AppDelegate: UIApplicationDelegate { didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) + coordinator = .init(router: WindowRouter(window)) + + guard let coordinator else { + fatalError("AppCoordinator should have been instantiated") + } - window?.rootViewController = UINavigationController(rootViewController: FeedListViewController()) - window?.makeKeyAndVisible() + coordinator.present(animated: false) + coordinator.present( + child: FeedListCoordinator( + router: StackRouter(coordinator.navigationController) + ), + animated: false + ) return true }