gpt4 book ai didi

swift - Clean swift 如何将数据传回 viewController

转载 作者:可可西里 更新时间:2023-11-01 01:58:36 24 4
gpt4 key购买 nike

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"
}


}

当我弹出到 navigationController 时,我无法接收数据

最佳答案

我们应该可以查看 Controller ,例如

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)
}

关于swift - Clean swift 如何将数据传回 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48639191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com