From 30bb62e795e4dba4233964c3c58d2c71c274a6d7 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 11 Apr 2023 18:14:20 +0200 Subject: [PATCH] Implemented the WindowRouter router in the Core library. --- .../Sources/Core/Routers/WindowRouter.swift | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Apps/Locations/Libraries/Sources/Core/Routers/WindowRouter.swift diff --git a/Apps/Locations/Libraries/Sources/Core/Routers/WindowRouter.swift b/Apps/Locations/Libraries/Sources/Core/Routers/WindowRouter.swift new file mode 100644 index 0000000..6cbe31b --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Core/Routers/WindowRouter.swift @@ -0,0 +1,39 @@ +// +// WindowRouter.swift +// Core +// +// Created by Javier Cicchelli on 11/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +import UIKit + +public class WindowRouter: Router { + + // MARK: Properties + + private let window: UIWindow? + + // MARK: Initialisers + + public init(window: UIWindow?) { + self.window = window + } + + // MARK: Functions + + public func present( + _ viewController: UIViewController, + animated: Bool, + onDismiss: OnDismissedClosure? + ) { + window?.rootViewController = viewController + + window?.makeKeyAndVisible() + } + + public func dismiss(animated: Bool) { + // Nothing to do here... + } + +}