[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:
+4
-4
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NavigationRouter.swift
|
||||
// BaseNavigationRouter.swift
|
||||
// ReviewsCoordinationKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 21/03/2024.
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public class NavigationRouter: NSObject {
|
||||
open class BaseNavigationRouter: NSObject {
|
||||
|
||||
// MARK: Properties
|
||||
var navigationController: UINavigationController
|
||||
var onDismissForViewController: [UIViewController: Router.OnDismissClosure] = [:]
|
||||
|
||||
// MARK: Initialisers
|
||||
init(navigationController: UINavigationController) {
|
||||
public init(navigationController: UINavigationController) {
|
||||
self.navigationController = navigationController
|
||||
|
||||
super.init()
|
||||
@@ -37,7 +37,7 @@ public class NavigationRouter: NSObject {
|
||||
}
|
||||
|
||||
// MARK: - UINavigationControllerDelegate
|
||||
extension NavigationRouter: UINavigationControllerDelegate {
|
||||
extension BaseNavigationRouter: UINavigationControllerDelegate {
|
||||
|
||||
// MARK: Functions
|
||||
public func navigationController(
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// File.swift
|
||||
// StackRouter.swift
|
||||
// ReviewsCoordinationKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 21/03/2024.
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public class PushRouter: NavigationRouter {
|
||||
public class StackRouter: BaseNavigationRouter {
|
||||
|
||||
// MARK: Constants
|
||||
private let rootViewController: UIViewController?
|
||||
|
||||
// MARK: Initialisers
|
||||
public init(
|
||||
navigationController: UINavigationController,
|
||||
_ navigationController: UINavigationController,
|
||||
rootViewController: UIViewController? = nil
|
||||
) {
|
||||
self.rootViewController = navigationController.viewControllers.first ?? rootViewController
|
||||
@@ -26,13 +26,13 @@ public class PushRouter: NavigationRouter {
|
||||
}
|
||||
|
||||
// MARK: - Router
|
||||
extension PushRouter: Router {
|
||||
extension StackRouter: Router {
|
||||
|
||||
// MARK: Functions
|
||||
public func present(
|
||||
_ viewController: UIViewController,
|
||||
animated: Bool,
|
||||
onDismiss: OnDismissClosure?
|
||||
onDismiss: OnDismissClosure? = nil
|
||||
) {
|
||||
onDismissForViewController[viewController] = onDismiss
|
||||
|
||||
@@ -14,7 +14,7 @@ public class WindowRouter: Router {
|
||||
private let window: UIWindow?
|
||||
|
||||
// MARK: Initialisers
|
||||
public init(window: UIWindow?) {
|
||||
public init(_ window: UIWindow?) {
|
||||
self.window = window
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class WindowRouter: Router {
|
||||
public func present(
|
||||
_ viewController: UIViewController,
|
||||
animated: Bool,
|
||||
onDismiss: OnDismissClosure?
|
||||
onDismiss: OnDismissClosure? = nil
|
||||
) {
|
||||
window?.rootViewController = viewController
|
||||
window?.makeKeyAndVisible()
|
||||
|
||||
Reference in New Issue
Block a user