SecondModule.md
December 26, 2022 ยท View on GitHub
Present second module
- Go to
MainFlowCoordinator.swift - Replace
TODOand pass shared state (via child store) toRandomizermodule
func mainModuleDidTapRandomButton() {
let childStore = store.createChildStore(
keyPath: \.count,
reducer: RandomizerFeature.reducer(),
middleware: RandomizerFeature.middleware(
environment: .init(moduleOutput: self)
)
)
let randomizeViewController = RandomizerModuleBuilder().build(store: childStore)
rootViewController.present(randomizeViewController, animated: true)
}
- Implement
RandomizerModuleOutput
extension MainFlowCoordinator: RandomizerModuleOutput {
func randomizerModuleDidTapCloseButton() {
rootViewController.dismiss(animated: true)
}
}