//
//  CoordinatorProtocol.swift
//  1Weather
//
//  Created by Dmitry Stepanets on 30.06.2020.
//  Copyright © 2020 Dynamix Software. All rights reserved.
//

import UIKit

protocol Coordinator: AnyObject {
    var childCoordinators: [Coordinator] { get set }
    var parentCoordinator:Coordinator? { get set }
    func start()
    func viewControllerDidEnd(controller:UIViewController)
}

extension Coordinator {
    func childDidFinish(child:Coordinator) {
        for (index, coordinator) in childCoordinators.enumerated() {
            if coordinator === child {
                childCoordinators.remove(at: index)
                break
            }
        }
    }
}
