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
| private func runAuthFlow() { | |
| let coordinator = coordinatorFactory.makeAuthCoordinatorBox(router: router) | |
| coordinator.finishFlow = { [weak self, weak coordinator] in | |
| isAutorized = true | |
| self?.start() //here we'll check instruction | |
| self?.removeDependency(coordinator) | |
| } | |
| addDependency(coordinator) | |
| coordinator.start() | |
| } |
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
| override func start(with option: DeepLinkOption?) { | |
| //start with deepLink | |
| if let option = option { | |
| switch option { | |
| case .onboarding: runOnboardingFlow() | |
| case .signUp: runAuthFlow() | |
| default: childCoordinators.forEach { coordinator in | |
| coordinator.start(with: option) | |
| } | |
| } |
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
| fileprivate enum LaunchInstructor { | |
| case main, auth, onboarding | |
| static func configure(tutorialWasShown: Bool, isAutorized: Bool) -> LaunchInstructor { | |
| switch (tutorialWasShown, isAutorized) { | |
| case (true, false), (false, false): return .auth | |
| case (false, true): return .onboarding | |
| case (true, true): return .main | |
| } | |
| } |
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
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| var rootController: UINavigationController { | |
| return self.window!.rootViewController as! UINavigationController | |
| } | |
| private lazy var applicationCoordinator: Coordinator = self.makeCoordinator() | |
| func application(_ application: UIApplication, |
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 | |
| protocol Reflectable { | |
| func properties<T>() -> [T] | |
| } | |
| extension Reflectable { | |
| func properties<T>() -> [T] { | |
| var s = [T]() | |
| Mirror(reflecting: self).children.forEach { property in |
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
| moduleA.onNext = { [weak self] dict in | |
| self?.storage.dict = dict | |
| self?.showModuleB() | |
| } |
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
| class ModuleFactoryImp: | |
| AuthModuleFactory, | |
| ItemModuleFactory, | |
| ItemCreateModuleFactory, | |
| SettingsModuleFactory { | |
| /* implementation */ | |
| } |
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
| protocol ItemModuleFactory { | |
| func makeItemsOutput() -> ItemsListView | |
| func makeItemDetailOutput(item: ItemList) -> ItemDetailView | |
| } |
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 makeItemDetailOutput(item: Item) -> ItemDetailView { | |
| let controller = ItemDetailController.controllerFromStoryboard(.items) | |
| controller.item = item | |
| return controller | |
| } |
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
| protocol Presentable { | |
| func toPresent() -> UIViewController? | |
| } |