@@ -19,22 +19,36 @@ class ThirdStepReservationCoordinator: BaseCoordinator {
1919 /// Объект регистрации, созданной или существующей
2020 var resrvation: Reservation?
2121
22+ var reservationVC: ThirdStepReservationViewController?
23+
2224 // MARK: - Lifecycle
2325
2426 override func start() {
2527 let storyboard = UIStoryboard(name: "Reservation", bundle: nil)
26− let reservationVC = storyboard.instantiateViewController(withIdentifier: "ThirdStepReservationViewController") as! ThirdStepReservationViewController
28+ reservationVC = storyboard.instantiateViewController(withIdentifier: "ThirdStepReservationViewController") as? ThirdStepReservationViewController
2729
28− reservationVC.coordinator = self
29− reservationVC.mapView = mapView
30− reservationVC.reservation = resrvation
30+ reservationVC?.coordinator = self
31+ reservationVC?.mapView = mapView
32+ reservationVC?.reservation = resrvation
3133
32− navigationController?.pushViewController(reservationVC, animated: false)
34+ guard let r = reservationVC else { return }
35+ navigationController?.pushViewController(r, animated: false)
3336 }
3437
3538 /// You need to pass reservation object and map describing booked table
3639 func change(_ reservation: Reservation, _ map: MapImageScroll) {
37− //
40+ let changeCoordinator = ChangeReservationCoordinator(navigationController: navigationController)
41+
42+ changeCoordinator.reservation = reservation
43+ changeCoordinator.map = map
44+
45+ changeCoordinator.didFinish = { [weak self] res in
46+ self?.removeDependency(changeCoordinator)
47+ self?.navigationController?.popViewController(animated: false)
48+ self?.reservationVC?.reservation = res
49+ }
50+
51+ changeCoordinator.start()
3852 }
3953
4054 /// Goes back to `allReservations` screen