// // NYWindow.swift // JiaPeiManage // // Created by Ning.ge on 2023/8/3. // import UIKit struct NYWindow { ///获取当前控制器 static func currentVc() ->UIViewController{ var vc = UIApplication.shared.keyWindow?.rootViewController if (vc?.isKind(of: UITabBarController.self))! { vc = (vc as! UITabBarController).selectedViewController }else if (vc?.isKind(of: UINavigationController.self))!{ vc = (vc as! UINavigationController).visibleViewController }else if ((vc?.presentedViewController) != nil){ vc = vc?.presentedViewController } return vc! } }