From 1b4fde9adb8cec7b1435055fcdcb0687b87b0f02 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 21 Mar 2024 16:26:00 +0100 Subject: [PATCH] Implemented the Router protocol in the Coordination library. --- .../Kit/Sources/Protocols/Router.swift | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Libraries/Coordination/Kit/Sources/Protocols/Router.swift diff --git a/Libraries/Coordination/Kit/Sources/Protocols/Router.swift b/Libraries/Coordination/Kit/Sources/Protocols/Router.swift new file mode 100644 index 0000000..4a256a9 --- /dev/null +++ b/Libraries/Coordination/Kit/Sources/Protocols/Router.swift @@ -0,0 +1,42 @@ +// +// Router.swift +// ReviewsCoordinationKet +// +// Created by Javier Cicchelli on 21/03/2024. +// Copyright © 2024 Röck+Cöde. All rights reserved. +// + +import UIKit + +public protocol Router: AnyObject { + + // MARK: Type aliases + typealias OnDismissClosure = () -> Void + + // MARK: Functions + func present( + _ viewController: UIViewController, + animated: Bool, + onDismiss: OnDismissClosure? + ) + + func dismiss(animated: Bool) + +} + +// MARK: - Implementations +public extension Router { + + // MARK: Functions + func present( + _ viewController: UIViewController, + animated: Bool + ) { + present( + viewController, + animated: animated, + onDismiss: nil + ) + } + +}