This PR contains the work done to implement the necessary protocols and router to implement the Coordinators pattern in the app. Reviewed-on: #15 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
36 lines
731 B
Swift
36 lines
731 B
Swift
//
|
|
// WindowRouter.swift
|
|
// ReviewsCoordinationKit
|
|
//
|
|
// Created by Javier Cicchelli on 21/03/2024.
|
|
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
public class WindowRouter: Router {
|
|
|
|
// MARK: Constants
|
|
private let window: UIWindow?
|
|
|
|
// MARK: Initialisers
|
|
public init(window: UIWindow?) {
|
|
self.window = window
|
|
}
|
|
|
|
// MARK: Functions
|
|
public func present(
|
|
_ viewController: UIViewController,
|
|
animated: Bool,
|
|
onDismiss: OnDismissClosure?
|
|
) {
|
|
window?.rootViewController = viewController
|
|
window?.makeKeyAndVisible()
|
|
}
|
|
|
|
public func dismiss(animated: Bool) {
|
|
// Nothing to do here...
|
|
}
|
|
|
|
}
|