Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiang1994 committed Apr 9, 2024
1 parent 2cc6f92 commit 34909e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/UIViewControllerExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import UIKit
extension UIViewController {

/// 获取Window下的顶层控制器
@objc
open class func top(in window: UIWindow? = .none) -> UIViewController? {
return (window ?? UIApplication.shared.window)?.rootViewController?.top()
}

@objc
open func top() -> UIViewController {
// presented view controller
if let controller = presentedViewController {
Expand Down

0 comments on commit 34909e4

Please sign in to comment.