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>
43 lines
782 B
Swift
43 lines
782 B
Swift
//
|
|
// 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
|
|
)
|
|
}
|
|
|
|
}
|