mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Fix applying safe area insets on iOS
This commit is contained in:
15
iOS/SafeArea.swift
Normal file
15
iOS/SafeArea.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
struct SafeArea {
|
||||
static var insets: UIEdgeInsets {
|
||||
let keyWindow = UIApplication.shared.connectedScenes
|
||||
.filter { $0.activationState == .foregroundActive }
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.first?
|
||||
.windows
|
||||
.first { $0.isKeyWindow }
|
||||
|
||||
return keyWindow?.safeAreaInsets ?? .init()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user