0

ValidateDrop method is not working.

func tableView(_ tableView: NSTableView, writeRowsWith rowIndexes: IndexSet, to pboard: NSPasteboard) -> Bool {

    let data = NSKeyedArchiver.archivedData(withRootObject: rowIndexes)
    pboard.declareTypes([NSPasteboard.PasteboardType(rawValue: "public.data")], owner: self)
    pboard.setData(data, forType: NSPasteboard.PasteboardType(rawValue: "public.data"))

    print("WriteRows")

    return true
}

func tableView(_ tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedRow row: Int, proposedDropOperation dropOperation: NSTableView.DropOperation) -> NSDragOperation {

    if dropOperation == .above {
        return .move
    }

    print("acceptDrop")

    return []
}

"WriteRows" is printed but validatedRow doesn't work and doesn't print.

At the first attempt of dragging this message is printed.

2018-03-02 12:55:05.785644+0100 Plantilla[37119:1093734] MessageTracer: load_domain_whitelist_search_tree:73: Search tree file's format version number (0) is not supported

2018-03-02 12:55:05.785702+0100 Plantilla[37119:1093734] MessageTracer: Falling back to default whitelist

JoseIgnacio
  • 74
  • 1
  • 11
  • Are the messages related to drag & drop? Are `validatedRow`, `validateDrop` and `print("acceptDrop")` the same method? Is `validateDrop` called? Can you post your implementation of `acceptDrop`? – Willeke Mar 03 '18 at 07:57

1 Answers1

0

I missed to Register table view to a specifically allowed type of object which can be dragged. Found solution here:

tableView.registerForDraggedTypes([NSPasteboard.PasteboardType("public.data")])
JoseIgnacio
  • 74
  • 1
  • 11