This file contains 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? | |
} |
This file contains 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 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 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 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 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 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 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
struct DeepLinkURLConstants { | |
static let Onboarding = "onboarding" | |
static let Items = "items" | |
static let Item = "item" | |
static let Settings = "settings" | |
} | |
enum DeepLinkOption { | |
case onboarding | |
case items |
This file contains 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 Coordinator: class { | |
func start() | |
func start(with option: DeepLinkOption?) | |
} |
This file contains 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) | |
} | |
} |