Skip to content

Instantly share code, notes, and snippets.

@stevebartholomew
Last active September 21, 2016 12:38
Show Gist options
  • Save stevebartholomew/d42f5c87bb4ff82e06b3 to your computer and use it in GitHub Desktop.
Save stevebartholomew/d42f5c87bb4ff82e06b3 to your computer and use it in GitHub Desktop.
func tableView(tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableViewDropOperation) -> Bool {
var pasteboard = info.draggingPasteboard()
var rowData = pasteboard.dataForType(MyRowType)
if(rowData != nil) {
var dataArray = NSKeyedUnarchiver.unarchiveObjectWithData(rowData!) as! Array<NSIndexSet>,
indexSet = dataArray[0]
var movingFromIndex = indexSet.firstIndex
var item = items[movingFromIndex] as! String
// ...work to move the item
return true
}
else {
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment