|
@@ -11,7 +11,7 @@ import SwiftUI
|
|
|
final class MainCoordinator: BaseCoordinator, ObservableObject {
|
|
final class MainCoordinator: BaseCoordinator, ObservableObject {
|
|
|
|
|
|
|
|
@Published
|
|
@Published
|
|
|
- var presenting: Route?
|
|
|
|
|
|
|
+ var presentation: Route?
|
|
|
|
|
|
|
|
func run() -> some View {
|
|
func run() -> some View {
|
|
|
showMainModule()
|
|
showMainModule()
|
|
@@ -33,6 +33,22 @@ final class MainCoordinator: BaseCoordinator, ObservableObject {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ViewBuilder
|
|
|
|
|
+ func buildPresentation(_ route: Route) -> some View {
|
|
|
|
|
+ switch route {
|
|
|
|
|
+ case .products:
|
|
|
|
|
+ ModalProductsNavigationView.build(with: ModalProductsCoordinator().then { addChild($0) })
|
|
|
|
|
+ case .cart:
|
|
|
|
|
+ showCartModule()
|
|
|
|
|
+ default:
|
|
|
|
|
+ fatalError("This should not happen!")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ func onDismissPresentation() {
|
|
|
|
|
+ removeLastChild()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// MARK: - Private methods
|
|
// MARK: - Private methods
|
|
|
|
|
|
|
|
private func showMainModule() -> some View {
|
|
private func showMainModule() -> some View {
|
|
@@ -51,10 +67,10 @@ final class MainCoordinator: BaseCoordinator, ObservableObject {
|
|
|
self?.currentRouter.push(Route.feedback)
|
|
self?.currentRouter.push(Route.feedback)
|
|
|
},
|
|
},
|
|
|
onModalProducts: { [weak self] in
|
|
onModalProducts: { [weak self] in
|
|
|
- self?.presenting = .products
|
|
|
|
|
|
|
+ self?.presentation = .products
|
|
|
},
|
|
},
|
|
|
onModalCart: { [weak self] in
|
|
onModalCart: { [weak self] in
|
|
|
- self?.presenting = .cart
|
|
|
|
|
|
|
+ self?.presentation = .cart
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|