mirror of
https://github.com/confirmedcode/Lockdown-iOS.git
synced 2026-03-02 18:23:49 +01:00
25 lines
662 B
Swift
25 lines
662 B
Swift
//
|
|
// UIApplication+Extension.swift
|
|
// Lockdown
|
|
//
|
|
// Created by Aliaksandr Dvoineu on 3.05.23.
|
|
// Copyright © 2023 Confirmed Inc. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UIApplication {
|
|
|
|
class func getTopMostViewController() -> UIViewController? {
|
|
let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
|
|
if var topController = keyWindow?.rootViewController {
|
|
while let presentedViewController = topController.presentedViewController {
|
|
topController = presentedViewController
|
|
}
|
|
return topController
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|
|
}
|