From 16de0feec6b576d045d60d0c48e1e4b203f5ea4c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 21 Mar 2024 17:35:42 +0100 Subject: [PATCH] Implemented the WindowRouter router in the Coordination library. --- .../Kit/Sources/Routers/WindowRouter.swift | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Libraries/Coordination/Kit/Sources/Routers/WindowRouter.swift diff --git a/Libraries/Coordination/Kit/Sources/Routers/WindowRouter.swift b/Libraries/Coordination/Kit/Sources/Routers/WindowRouter.swift new file mode 100644 index 0000000..21c7194 --- /dev/null +++ b/Libraries/Coordination/Kit/Sources/Routers/WindowRouter.swift @@ -0,0 +1,35 @@ +// +// 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... + } + +}