diff options
| author | Dustin Mierau <dustin@mierau.me> | 2025-10-24 14:16:30 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2025-10-24 14:16:30 -0700 |
| commit | 8bab12046b2c91cff7e1194e576acecf57551e08 (patch) | |
| tree | efd06a26ee7a12e43b6d77c147347459f8092427 /Hotline/Utility | |
| parent | 2df678753e2e6fe309de6b546925540f89e3d680 (diff) | |
Further along work towards auto updating. Show release notes for the builds that are more recent than yours.
Diffstat (limited to 'Hotline/Utility')
| -rw-r--r-- | Hotline/Utility/NSWindowBridge.swift | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Hotline/Utility/NSWindowBridge.swift b/Hotline/Utility/NSWindowBridge.swift index 5cd7197..8f766d9 100644 --- a/Hotline/Utility/NSWindowBridge.swift +++ b/Hotline/Utility/NSWindowBridge.swift @@ -23,3 +23,24 @@ public struct NSWindowAccessor: NSViewRepresentable { public func makeNSView(context: Context) -> NSView { return NSWindowAccessorView( configCode ) } public func updateNSView(_ nsView: NSView, context: Context) {} } + + +//import SwiftUI + + /// A helper view you can embed once per window to run a closure +/// with the underlying NSWindow reference. +struct WindowConfigurator: NSViewRepresentable { + let configure: (NSWindow) -> Void + + func makeNSView(context: Context) -> NSView { + let view = NSView() + DispatchQueue.main.async { + if let window = view.window { + configure(window) + } + } + return view + } + + func updateNSView(_ nsView: NSView, context: Context) { } +} |