mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-21 17:08:36 +03:00
15 lines
437 B
Swift
15 lines
437 B
Swift
import SwiftUI
|
|
|
|
struct HostingWindowKey: EnvironmentKey {
|
|
typealias Value = () -> NSWindow? // needed for weak link
|
|
static let defaultValue: Self.Value = { nil }
|
|
}
|
|
|
|
extension EnvironmentValues {
|
|
/// This can be used to set the hosting NSWindow to a NSHostingView
|
|
var hostingWindow: HostingWindowKey.Value {
|
|
get { return self[HostingWindowKey.self] }
|
|
set { self[HostingWindowKey.self] = newValue }
|
|
}
|
|
}
|