//
//  UINavigationController+Ext.swift.swift
//  LegendTeam
//
//  Created by dong on 2021/12/27.
//

import Foundation
import UIKit

extension UINavigationController {
    @discardableResult
    public func popToViewControllerType(type: AnyClass) -> UIViewController? {
        let vcs = viewControllers.reversed()
        for vc in vcs {
            if vc.isKind(of: type) {
                popToViewController(vc, animated: true)
                return vc
            }
        }
        return nil
    }

    override open var childForStatusBarStyle: UIViewController? {
        return viewControllers.last
    }
}
