Segue 调用了两次 - IOS

Segue called twice - IOS

我在我的项目中使用来自 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!]
    }
}

并且:

解决了我的问题,我像下面这样编辑了我的源代码,现在工作得很好:

@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!]
    }
}