import AppKit @MainActor final class StackDropPreview: NSView { override init(frame: CGRect) { super.init(frame: frame) wantsLayer = true setAccessibilityElement(false) } required init?(coder: NSCoder) { fatalError("init(coder:) is unavailable") } override func draw(_ dirtyRect: NSRect) { let border = NSBezierPath(roundedRect: bounds.insetBy(dx: 3, dy: 3), xRadius: 8, yRadius: 8) NSColor.controlAccentColor.setStroke() border.lineWidth = NSWorkspace.shared.accessibilityDisplayShouldIncreaseContrast ? 4 : 2 border.stroke() let label = NSAttributedString( string: UIStrings.text("Move here"), attributes: [.font: NSFont.systemFont(ofSize: 13, weight: .semibold), .foregroundColor: NSColor.labelColor]) let size = label.size() let bubble = CGRect( x: (bounds.width - size.width) / 2 - 12, y: (bounds.height - size.height) / 2 - 6, width: size.width + 24, height: size.height + 12) NSColor.windowBackgroundColor.setFill() NSBezierPath(roundedRect: bubble, xRadius: 8, yRadius: 8).fill() label.draw(at: CGPoint(x: bubble.minX + 12, y: bubble.minY + 6)) } }