blob: 86d4ca0493f36546c2795759555d88e8bdd9012d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//
// 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
}
}
|