// // PasteboardItem.swift // Subler // // Created by Damiano Galassi on 22/09/2026. // import Cocoa extension NSPasteboard.PasteboardType { static let tableViewIndex = NSPasteboard.PasteboardType("org.subler.tableViewIndex") } class PasteboardItem: NSObject, NSPasteboardWriting { let index: Int let type: NSPasteboard.PasteboardType init(index: Int, type: NSPasteboard.PasteboardType) { self.index = index self.type = type } func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] { return [type] } func pasteboardPropertyList(forType type: NSPasteboard.PasteboardType) -> Any? { switch type { case self.type: return index default: return nil } } } extension NSPasteboardItem { func integer(forType type: NSPasteboard.PasteboardType) -> Int? { guard let data = data(forType: type) else { return nil } let plist = try? PropertyListSerialization.propertyList( from: data, options: .mutableContainers, format: nil) return plist as? Int } } extension Array { mutating func move(from start: Index, to end: Index) { guard (0..