This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "Stephen Bartholomew", | |
| "email": "[email protected]", | |
| "age": 34, | |
| "languages": ["Ruby", "Javascript"] | |
| }, | |
| { | |
| "name": "Tim Peat", | |
| "email": "[email protected]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedRow row: Int, proposedDropOperation dropOperation: NSTableViewDropOperation) -> NSDragOperation { | |
| tableView.setDropRow(row, dropOperation: NSTableViewDropOperation.Above) | |
| return NSDragOperation.Move | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func viewDidLoad() { | |
| // … | |
| tableView.registerForDraggedTypes([MyRowType, NSFilenamesPboardType]) | |
| //… | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let MyRowType = “MyRowType" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(tableView: NSTableView, writeRowsWithIndexes: NSIndexSet, toPasteboard: NSPasteboard) -> Bool { | |
| var data = NSKeyedArchiver.archivedDataWithRootObject([writeRowsWithIndexes]) | |
| toPasteboard.declareTypes([MyRowType], owner:self) | |
| toPasteboard.setData(data, forType:MyRowType) | |
| return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>, |
OlderNewer