2
class ListBillPaymentFavoriteRouter: NSObject, ListBillPaymentFavoriteRoutingLogic, ListBillPaymentFavoriteDataPassing {
    weak var viewController: ListBillPaymentFavoriteViewController?
    var dataStore: ListBillPaymentFavoriteDataStore?

    // MARK: Routing

    func routeToBillPaymentInput() {
        let destinationVC = BillPaymentInputViewController.instantiate()
        var destinationDS =  destinationVC.router!.dataStore!
        passDataToBillPaymentInput(source: dataStore!, destination: &destinationDS)
        navigationToBillPaymentInput(source: viewController!, destination: destinationVC)
    }

    // MARK: Navigation

    func navigationToBillPaymentInput(source: ListBillPaymentFavoriteViewController, destination: BillPaymentInputViewController) {
        source.navigationController?.pop_FromLeftMoveToRight()
    }

    // MARK: Passing data

    func passDataToBillPaymentInput(source: ListBillPaymentFavoriteDataStore, destination: inout BillPaymentInputDataStore) {
        destination.testTest = "Yessssss"
    }


}

When I pop to navigationController I can't receive data

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

2 Answers2

0

We should could viewController, example

func routeToBillPaymentInput() {
    let index = viewController!.navigationController!.viewControllers.count - 2
    let destinationVC = viewController?.navigationController?.viewControllers[index] as! BillPaymentInputViewController
    var destinationDS =  destinationVC.router!.dataStore!
    passDataToBillPaymentInput(source: dataStore!, destination: &destinationDS)
    navigationToBillPaymentInput(source: viewController!, destination: destinationVC)
}
0

At all

class ListBillPaymentFavoriteRouter: NSObject, ListBillPaymentFavoriteRoutingLogic, ListBillPaymentFavoriteDataPassing {
weak var viewController: ListBillPaymentFavoriteViewController?
var dataStore: ListBillPaymentFavoriteDataStore?

// MARK: Routing

func routeToBillPaymentInput() {
    let index = viewController!.navigationController!.viewControllers.count - 2
    let destinationVC = viewController?.navigationController?.viewControllers[index] as! BillPaymentInputViewController
    var destinationDS =  destinationVC.router!.dataStore!
    passDataToBillPaymentInput(source: dataStore!, destination: &destinationDS)
    navigationToBillPaymentInput(source: viewController!, destination: destinationVC)
}

// MARK: Navigation

func navigationToBillPaymentInput(source: ListBillPaymentFavoriteViewController, destination: BillPaymentInputViewController) {
    source.navigationController?.popViewController(animated: true)
}

// MARK: Passing data

func passDataToBillPaymentInput(source: ListBillPaymentFavoriteDataStore, destination: inout BillPaymentInputDataStore) {
    destination.testTest = "Yessssss"

}

}