我在项目中的VIP
中正在使用,并且当我将用户路由到另一个场景时,请打开场景两次,我的路由器就像波纹管一样?如果您需要更多详细信息,请告诉我。谢谢
@objc protocol ListLanguageRoutingLogic
{
func routeToStartPage(segue: UIStoryboardSegue?)
}
protocol LangSelectedDataPassing
{
var dataStore: SelectLanguageDataStore? { get }
}
class RouterSelectLanguage: NSObject, ListLanguageRoutingLogic, LangSelectedDataPassing
{
weak var viewControllerSelectLanguage: ViewControllerSelectLanguage?
var dataStore: SelectLanguageDataStore?
func routeToStartPage(segue: UIStoryboardSegue?) {
print("BBB")
let destinationVC = viewControllerSelectLanguage?.storyboard?.instantiateViewController(withIdentifier: "ViewControllerStartPage") as! ViewControllerStartPage
var destinationDS = destinationVC.router!.dataStore!
passDataToStartPage(source: dataStore!, destination: &destinationDS)
navigateToStartPage(source: viewControllerSelectLanguage!, destination: destinationVC)
}
// MARK: Navigation
func navigateToStartPage(source: ViewControllerSelectLanguage, destination: ViewControllerStartPage)
{
source.show(destination, sender: nil)
}
// MARK: Passing data
func passDataToStartPage(source: SelectLanguageDataStore, destination: inout StartPageDataStore)
{
print("CCC")
let selectedRow = viewControllerSelectLanguage?.tblView.indexPathForSelectedRow?.row
destination.langSelected = source.langs?[selectedRow!]
}
}
并且:
答案 0 :(得分:0)
解决了我的问题,我现在编辑了波纹管这样的源代码,现在工作良好:
@objc protocol ListLanguageRoutingLogic
{
func routeToStartPage(segue: UIStoryboardSegue?)
}
protocol LangSelectedDataPassing
{
var dataStore: SelectLanguageDataStore? { get }
}
class RouterSelectLanguage: NSObject, ListLanguageRoutingLogic, LangSelectedDataPassing
{
weak var viewControllerSL: ViewControllerSelectLanguage?
var dataStore: SelectLanguageDataStore?
func routeToStartPage(segue: UIStoryboardSegue?) {
let destinationVC = segue!.destination as! ViewControllerStartPage
var destinationDS = destinationVC.startPageRouter!.dataStore!
passDataToStartPage(source: dataStore!, destination: &destinationDS)
}
// MARK: Passing data
func passDataToStartPage(source: SelectLanguageDataStore, destination: inout StartPageDataStore)
{
let selectedRow = viewControllerSL?.tblView.indexPathForSelectedRow?.row
destination.langSelected = source.langs?[selectedRow!]
}
}