启动

1. AppDelegate

coordinator = AppCoordinator(window: window!, keystore: keystore, navigator: urlNavigatorCoordinator)
        coordinator.start()

2. AppCoordinator

init(
        window: UIWindow,
        keystore: Keystore,
        navigator: URLNavigatorCoordinator = URLNavigatorCoordinator(),
        navigationController: NavigationController = NavigationController()
    ) {
        self.navigationController = navigationController
        self.keystore = keystore
        self.navigator = navigator
        super.init()
        window.rootViewController = navigationController
        window.makeKeyAndVisible()
    }

3. InCoordinator

四个Tab的总入口;

    func showTransactions(for wallet: WalletInfo) {
        let coordinator = InCoordinator(
            navigationController: navigationController,
            wallet: wallet,
            keystore: keystore,
            appTracker: appTracker,
            navigator: navigator.navigator
        )
        coordinator.delegate = self
        coordinator.start()
        addCoordinator(coordinator)

        // Activate last event on first sign in
        guard let event = navigator.branch.lastEvent else { return }
        coordinator.handleEvent(event)
        navigator.branch.clearEvents()
    }

你可能感兴趣的:(启动)