Skip to content

Commit 82556a9

Browse files
committed
Update UIApplicationExtension.swift
1 parent c93ced9 commit 82556a9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/SwiftBoost/UIKit/Extensions/UIApplicationExtension.swift

+11
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@ public extension UIApplication {
2525
guard let rootViewController = scene.windows.first?.rootViewController else { return nil }
2626
return rootViewController
2727
}
28+
29+
var topController: UIViewController? {
30+
if var topController = self.rootController {
31+
while let presentedViewController = topController.presentedViewController {
32+
topController = presentedViewController
33+
}
34+
return topController
35+
}
36+
return nil
37+
}
38+
2839
}
2940
#endif

0 commit comments

Comments
 (0)