посмотри на код ниже и добавь документацию для публичных методов import SwiftUI public…
- User
посмотри на код ниже и добавь документацию для публичных методов import SwiftUI
public extension EnvironmentValues { var safeAreaInsets: EdgeInsets { self[SafeAreaInsetsKey.self] }
var screenBounds: CGRect { self[ScreenBoundsKey.self] }}
extension UIApplication { var keyWindow: UIWindow? { connectedScenes .compactMap { 0 as? UIWindowScene } .flatMap { 0.windows } .first { $0.isKeyWindow } } }
private struct SafeAreaInsetsKey: EnvironmentKey { static var defaultValue: EdgeInsets { UIApplication.shared.keyWindow?.safeAreaInsets.swiftUiInsets ?? EdgeInsets() } }
private struct ScreenBoundsKey: EnvironmentKey { static var defaultValue: CGRect { UIApplication.shared.keyWindow?.screen.bounds ?? UIScreen.main.bounds } }
private extension UIEdgeInsets { var swiftUiInsets: EdgeInsets { EdgeInsets(top: top, leading: left, bottom: bottom, trailing: right) } }
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.