Created
December 19, 2022 11:00
-
-
Save aybarsyalcin/aa800e2cb2932f4674f6c4e4ea4c1054 to your computer and use it in GitHub Desktop.
Flow Coordinators - Part 3
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 CoordinatorFactory { | |
func makeHomeCoordinator(router: Router) -> Coordinator & HomeCoordinatorOutput | |
func makeAddressCoordinator(router: Router) -> Coordinator & AddressCoordinatorOutput | |
} |
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
final class CoordinatorFactoryImp: CoordinatorFactory { | |
func makeHomeCoordinator(router: Router) -> Coordinator & HomeCoordinatorOutput { | |
let coordinator = HomeCoordinator(router: router, factory: ModuleFactoryImp(), coordinatorFactory: CoordinatorFactoryImp()) | |
return coordinator | |
} | |
func makeAddressCoordinator(router: Router) -> Coordinator & AddressCoordinatorOutput { | |
let coordinator = AddressCoordinator(router: router, factory: ModuleFactoryImp(), coordinatorFactory: CoordinatorFactoryImp()) | |
return coordinator | |
} | |
} |
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
final class ModuleFactoryImp { | |
} | |
extension ModuleFactoryImp: HomeModuleFactory { | |
func makeDetailCoordinatorOutput() -> DetailCoordinatorView { | |
return DetailBuilder.make() | |
} | |
func makeHomeCoordinatorOutput() -> HomeCoordinatorView { | |
return HomeBuilder.make() | |
} | |
} | |
extension ModuleFactoryImp: AddressModuleFactory { | |
func makeAddressCoordinatorOutput() -> AddressCoordinatorView { | |
return AddressBuilder.make() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment