Skip to content

Commit

Permalink
Update UIApplicationExtension.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Nov 27, 2024
1 parent c93ced9 commit 82556a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/SwiftBoost/UIKit/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@ public extension UIApplication {
guard let rootViewController = scene.windows.first?.rootViewController else { return nil }
return rootViewController
}

var topController: UIViewController? {
if var topController = self.rootController {
while let presentedViewController = topController.presentedViewController {
topController = presentedViewController
}
return topController
}
return nil
}

}
#endif

0 comments on commit 82556a9

Please sign in to comment.