mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 08:18:19 +00:00
16 lines
402 B
Swift
16 lines
402 B
Swift
|
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()
|
||
|
}
|
||
|
}
|