[App] Integrated the Feed List to the App with coordinators (#16)
This PR contains the work done to implement the integration of the `FeedListViewController` view controller in the `Feed` framework to the `App` target by using coordinators. Reviewed-on: rock-n-code/app-reviews#16 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #16.
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// AppCoordinator.swift
|
||||
// App
|
||||
//
|
||||
// Created by Javier Cicchelli on 21/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ReviewsCoordinationKit
|
||||
import ReviewsFeed
|
||||
import UIKit
|
||||
|
||||
final class AppCoordinator: Coordinator {
|
||||
|
||||
// MARK: Constants
|
||||
let router: any Router
|
||||
|
||||
// MARK: Properties
|
||||
var children: [any Coordinator] = []
|
||||
|
||||
lazy var navigationController = UINavigationController()
|
||||
|
||||
// MARK: Initialisers
|
||||
init(router: any Router) {
|
||||
self.router = router
|
||||
}
|
||||
|
||||
// MARK: Functions
|
||||
func present(
|
||||
animated: Bool,
|
||||
onDismiss: Router.OnDismissClosure? = nil
|
||||
) {
|
||||
router.present(
|
||||
navigationController,
|
||||
animated: false
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user