// // MainCoordinator.swift // SUIExamples // // Created by Pavel Yurchenko on 28.11.2024. // import CoordinatorSUI import SwiftUI final class MainCoordinator: BaseCoordinator { init(router: Router) { super.init() self.currentRouter = router } func run() -> some View { showMainModule() } @ViewBuilder func buildDestination(_ route: Route) -> some View { switch route { case .products: showProductsModule() default: EmptyView() } } // MARK: - Private methods private func showMainModule() -> some View { MainBuilder().build( with: .init( onProducts: { [weak self] in self?.currentRouter.push(Route.products) }) ) } private func showProductsModule() -> some View { ProductsBuilder().build(with: .init()) } }