|
|
@@ -6,6 +6,7 @@
|
|
|
//
|
|
|
|
|
|
import CoordinatorSUI
|
|
|
+import SwiftUI
|
|
|
|
|
|
final class ApplicationCoordinator: BaseCoordinator {
|
|
|
|
|
|
@@ -16,19 +17,26 @@ final class ApplicationCoordinator: BaseCoordinator {
|
|
|
self.currentRouter = Self.rootRouter
|
|
|
}
|
|
|
|
|
|
- override func run() {
|
|
|
+ func run() -> some View {
|
|
|
runMainFlow()
|
|
|
}
|
|
|
|
|
|
+ func buildDestination(_ route: Route) -> some View {
|
|
|
+ guard let coordinator = currentCoordinator as? MainCoordinator else {
|
|
|
+ fatalError("Invalid coordinator type")
|
|
|
+ }
|
|
|
+ return coordinator.buildDestination(route)
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: - Private methods
|
|
|
|
|
|
- private func runMainFlow() {
|
|
|
+ private func runMainFlow() -> some View {
|
|
|
let coordinator = MainCoordinator(router: self.currentRouter)
|
|
|
addChild(coordinator)
|
|
|
coordinator.finishFlow = { [weak self] in
|
|
|
self?.removeChild(coordinator)
|
|
|
}
|
|
|
- coordinator.run()
|
|
|
+ return coordinator.run()
|
|
|
}
|
|
|
}
|
|
|
|