This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum SignInNavigationStep { | |
| case signIn | |
| } | |
| final class SignInViewModel: BaseViewModel< | |
| SignInNavigationStep, | |
| SignInViewModel.InputFromView, | |
| SignInViewModel.Output | |
| > { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder { | |
| lazy var window: UIWindow? = .default | |
| private lazy var appCoordinator = AppCoordinator( | |
| window: window!, | |
| deepLinkHandler: DeepLinkHandler(), | |
| useCaseProvider: DefaultUseCaseProvider.shared | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| /// Base protocol for any Coordinator. The coordinator is responsible for the navigation logic in the app. | |
| /// Since it has no `associatedtype` we can use it as the element for a `childCoordinators` array, which contains | |
| /// all the children of any coordinator. | |
| protocol AnyCoordinator: AnyObject { | |
| /// Coordinator stack, any child Coordinator should be appended to new array in order to retain it and handle its life cycle. | |
| var childCoordinators: [AnyCoordinator] { get set } | |
| /// This method is invoked by parent coodinator when this coordinator has been retained and presented. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import RxCocoa | |
| import RxSwift | |
| /// Base class for our coordinators. | |
| class BaseCoordinator<NavigationStep>: AnyCoordinator, Navigating { | |
| /// Coordinator stack, any child Coordinator should be appended to new array in order to retain it and handle its life cycle. | |
| var childCoordinators = [AnyCoordinator]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension BaseCoordinator { | |
| enum CoordinatorTransition { | |
| case append | |
| case replace | |
| } | |
| /// Starts a child coordinator which might be part of a flow of mutiple coordinators. | |
| /// Use this method when you know that you will finish the root coordinator at some | |
| /// point, which also will finish this new child coordinator. | |
| /// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension MainCoordinator { | |
| /// Starts a new temporary flow with a new Coordinator. | |
| /// | |
| /// "Temporary" meaning that it's expected that the new coordinator (the "child") | |
| /// is expected to finish and when it finishes the calling coordinator (the "parent") | |
| /// will remove it from its `childCoordinator` collection. | |
| /// | |
| /// The child coordinator initialized by the parent call-site, in the `makeCoordinator` closure. | |
| /// This function initializes a new `UINavigationController` that is passed into the | |
| /// by the `makeCoordinator` closure as an argument. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func toSetPincode() { | |
| presentModalCoordinator( | |
| makeCoordinator: { SetPincodeCoordinator(navigationController: $0, useCase: useCaseProvider.makePincodeUseCase()) }, | |
| navigationHandler: { userDid, dismissModalFlow in | |
| switch userDid { | |
| case .setPincode: dismissModalFlow(true) | |
| } | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension BaseCoordinator { | |
| /// This method is used to push a new Scene (ViewController). | |
| /// | |
| /// - Parameters: | |
| /// - scene: Type of `Scene` (UIViewController) to present. | |
| /// - viewModel: An instance of the ViewModel used by the `Scene`s View. | |
| /// - animated: Whether to animate the presentation of the scene or not. | |
| /// - navigationPresentationCompletion: Optional closure invoked when the | |
| /// presentation of the scene is done (animation has finished). This |