From ce0be87c7f39e9763d835a685cb65eb38c7e68c3 Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Wed, 21 Feb 2024 12:20:24 -0500 Subject: Cleanup + change SignInView to be a sheet --- Jel/Extensions/UIScreenCurrent.swift | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Jel/Extensions/UIScreenCurrent.swift (limited to 'Jel/Extensions/UIScreenCurrent.swift') diff --git a/Jel/Extensions/UIScreenCurrent.swift b/Jel/Extensions/UIScreenCurrent.swift new file mode 100644 index 0000000..86d4ca0 --- /dev/null +++ b/Jel/Extensions/UIScreenCurrent.swift @@ -0,0 +1,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 + } +} -- cgit v1.2.3