29 lines
513 B
Swift
29 lines
513 B
Swift
//
|
|
// UIScreenCurrent.swift
|
|
// Jel
|
|
//
|
|
// Created by zerocool on 1/8/24.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftUI
|
|
|
|
extension UIWindow {
|
|
static var current: UIWindow? {
|
|
for scene in UIApplication.shared.connectedScenes {
|
|
guard let windowScene = scene as? UIWindowScene else { continue }
|
|
for window in windowScene.windows {
|
|
if window.isKeyWindow { return window }
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
extension UIScreen {
|
|
static var current: UIScreen? {
|
|
UIWindow.current?.screen
|
|
}
|
|
}
|