diff --git a/example/ios/Demo/Architecture/ArchitectureView.swift b/example/ios/Demo/Architecture/ArchitectureView.swift index 9aba06554..1f6c87bea 100644 --- a/example/ios/Demo/Architecture/ArchitectureView.swift +++ b/example/ios/Demo/Architecture/ArchitectureView.swift @@ -62,18 +62,18 @@ struct ArchitectureView: View { } } .padding(10.0) - .navigation(state: contentRoutingState, type: .push) { - switch contentRoutingState.object { + .navigation(state: contentRoutingState, type: .push) { route in + switch route.object { case let .details(input): ArchitectureDetailsView(inputDetails: input) { result in viewModel.nameInput.post(newValue: result.name as NSString) viewModel.numberInput.post(newValue: NSString.init(format: "%d", result.number)) }.equatable() - .environmentObject(contentRoutingState as RoutingState) + .environmentObject(route as RoutingState) default: EmptyView() } } - .navigation(state: bottomSheetRoutingState, type: .partialSheet(style: PSIphoneStyle.defaultStyle())) { - BottomSheetView().equatable().environmentObject(bottomSheetRoutingState) + .navigation(state: bottomSheetRoutingState, type: .partialSheet(style: PSIphoneStyle.defaultStyle())) { route in + BottomSheetView().equatable().environmentObject(route) } .navigationTitle("feature_architecture".localized()) } diff --git a/example/ios/Demo/Architecture/BottomSheetView.swift b/example/ios/Demo/Architecture/BottomSheetView.swift index 9a6c45271..7450ef061 100644 --- a/example/ios/Demo/Architecture/BottomSheetView.swift +++ b/example/ios/Demo/Architecture/BottomSheetView.swift @@ -46,8 +46,8 @@ struct BottomSheetView: View, Equatable { Text(viewModel.text) viewModel.button.toButton(buttonFrame: .frame(maxWidth: .infinity)) }.padding(10.0) - .navigation(state: nextRoute, type: .push) { - BottomSheetSubPageView().environmentObject(BottomSheetSubPageView.RouteStack(previousRoute: nextRoute, parentRoute: previousRoute)) + .navigation(state: nextRoute, type: .push) { [unowned previousRoute] route in + BottomSheetSubPageView().environmentObject(BottomSheetSubPageView.RouteStack(previousRoute: route, parentRoute: previousRoute)) } .navigationViewStyle(.stack) .navigationBarItems( diff --git a/example/ios/Demo/Bluetooth/BluetoothListView.swift b/example/ios/Demo/Bluetooth/BluetoothListView.swift index 3a3a39694..1d5d7fb23 100644 --- a/example/ios/Demo/Bluetooth/BluetoothListView.swift +++ b/example/ios/Demo/Bluetooth/BluetoothListView.swift @@ -74,9 +74,9 @@ struct BluetoothListView: View { id: device.identifierString, type: .sheet, didSelect: { }, - content: { - if let route = deviceRoute.object { - switch route { + content: { route in + if let object = route.object { + switch object { case .details(let uuid): BluetoothDeviceDetailsView(identifier: uuid).equatable() } } diff --git a/example/ios/Demo/Resources/ResourcesListView.swift b/example/ios/Demo/Resources/ResourcesListView.swift index 326329052..fc40bf179 100644 --- a/example/ios/Demo/Resources/ResourcesListView.swift +++ b/example/ios/Demo/Resources/ResourcesListView.swift @@ -47,8 +47,8 @@ struct ResourcesListView: View { } } } - .navigation(state: navigationState, type: .push) { - switch navigationState.object { + .navigation(state: navigationState, type: .push) { state in + switch state.object { case .buttons: ButtonView().equatable() // For lifecycle subviews it is recommended to use equatable case .labels: LabelView() case .images: ImagesView() diff --git a/example/ios/Demo/Scientific/ScientificConverterView.swift b/example/ios/Demo/Scientific/ScientificConverterView.swift index e2e2fe20f..6a63cb50b 100644 --- a/example/ios/Demo/Scientific/ScientificConverterView.swift +++ b/example/ios/Demo/Scientific/ScientificConverterView.swift @@ -85,21 +85,21 @@ struct ScientificConverterView: View, Equatable { } } .padding(10.0) - .navigation(state: nextRoute, type: .sheet) { - if let routeObject = nextRoute.object { + .navigation(state: nextRoute, type: .sheet) { route in + if let routeObject = route.object { switch routeObject { case let .leftUnit(quantity): ScientificUnitSelectionView(quantity: quantity) { index in viewModel.didSelectLeftUnit(unitIndex: index) } .equatable() - .environmentObject(nextRoute as RoutingState) + .environmentObject(route as RoutingState) case let .rightUnit(quantity): ScientificUnitSelectionView(quantity: quantity) { index in viewModel.didSelectRightUnit(unitIndex: index) } .equatable() - .environmentObject(nextRoute as RoutingState) + .environmentObject(route as RoutingState) } } } diff --git a/example/ios/Demo/Scientific/ScientificView.swift b/example/ios/Demo/Scientific/ScientificView.swift index ef41e5f67..9526e1a40 100644 --- a/example/ios/Demo/Scientific/ScientificView.swift +++ b/example/ios/Demo/Scientific/ScientificView.swift @@ -78,12 +78,12 @@ struct ScientificView: View { id: converter.id, type: .push, didSelect: converter.button.action - ) { - if let route = converterRoute.object { - switch route { + ) { route in + if let object = route.object { + switch object { case let .converter(arguments): ScientificConverterView(arguments: arguments) .equatable() - .environmentObject(converterRoute as RoutingState) + .environmentObject(route as RoutingState) } } } @@ -91,7 +91,7 @@ struct ScientificView: View { } } .padding(.horizontal, 10.0) - .navigation(state: route, type: .sheet) { + .navigation(state: route, type: .sheet) { route in if let routeObject = route.object { switch routeObject { case let .leftUnit(quantity): diff --git a/example/ios/Kaluga-SwiftUI b/example/ios/Kaluga-SwiftUI index b5cc89a70..bfe168d25 160000 --- a/example/ios/Kaluga-SwiftUI +++ b/example/ios/Kaluga-SwiftUI @@ -1 +1 @@ -Subproject commit b5cc89a7047d4f1efedb5b6ff1b79e41892601b7 +Subproject commit bfe168d256000b09bf60f7688457339ac89b51a7