import AppKit import SwiftUI /// An AppKit drag surface for the non-activating panel. SwiftUI's hosting view consumes mouse /// events, so this view starts a native window drag on the first click. struct WindowDragArea: NSViewRepresentable { func makeNSView(context: Context) -> NSView { DragView() } func updateNSView(_ nsView: NSView, context: Context) {} } private final class DragView: NSView { override var mouseDownCanMoveWindow: Bool { true } override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true } override func mouseDown(with event: NSEvent) { window?.performDrag(with: event) } override func resetCursorRects() { addCursorRect(bounds, cursor: .openHand) } }