avoid using UIScreen.main

This commit is contained in:
Samuel Newman
2026-04-20 14:44:38 +03:00
parent e829b7a83e
commit 6275bda96e
2 changed files with 6 additions and 4 deletions
@@ -86,9 +86,11 @@ final class ImagePreviewController: UIViewController {
/// Caps the preview to a comfortable size within the current key window.
private static func sizeForAspect(_ aspect: CGFloat) -> CGSize {
let screen = UIScreen.main.bounds
let maxW = screen.width - 32
let maxH = screen.height * 0.7
let screenBounds = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.first?.screen.bounds ?? UIScreen.main.bounds
let maxW = screenBounds.width - 32
let maxH = screenBounds.height * 0.7
var w = maxW
var h = w / aspect
if h > maxH {