mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 19:53:25 +01:00
improve: use guard instead of if
This commit is contained in:
@@ -12,13 +12,11 @@ extension UIApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static var topController: UIViewController? {
|
static var topController: UIViewController? {
|
||||||
if var topController = keyWindow?.rootViewController {
|
guard var topController = keyWindow?.rootViewController else { return nil }
|
||||||
while let presentedViewController = topController.presentedViewController {
|
while let presentedViewController = topController.presentedViewController {
|
||||||
topController = presentedViewController
|
topController = presentedViewController
|
||||||
}
|
|
||||||
return topController
|
|
||||||
}
|
}
|
||||||
return nil
|
return topController
|
||||||
}
|
}
|
||||||
|
|
||||||
static func alert(
|
static func alert(
|
||||||
|
|||||||
Reference in New Issue
Block a user