|
|
@@ -24,6 +24,8 @@ final class MainCoordinator: BaseCoordinator {
|
|
|
switch route {
|
|
|
case .products:
|
|
|
showProductsModule()
|
|
|
+ case .cart:
|
|
|
+ showCartModule()
|
|
|
default: EmptyView()
|
|
|
}
|
|
|
}
|
|
|
@@ -35,11 +37,31 @@ final class MainCoordinator: BaseCoordinator {
|
|
|
with: .init(
|
|
|
onProducts: { [weak self] in
|
|
|
self?.currentRouter.push(Route.products)
|
|
|
- })
|
|
|
+ },
|
|
|
+ onCart: { [weak self] in
|
|
|
+ self?.currentRouter.push(Route.cart)
|
|
|
+ }
|
|
|
+ )
|
|
|
)
|
|
|
}
|
|
|
|
|
|
private func showProductsModule() -> some View {
|
|
|
- ProductsBuilder().build(with: .init())
|
|
|
+ ProductsBuilder().build(
|
|
|
+ with: .init(
|
|
|
+ onCart: { [weak self] in
|
|
|
+ self?.currentRouter.push(Route.cart)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ private func showCartModule() -> some View {
|
|
|
+ CartBuilder().build(
|
|
|
+ with: .init(
|
|
|
+ onProducts: { [weak self] in
|
|
|
+ self?.currentRouter.push(Route.products)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ )
|
|
|
}
|
|
|
}
|