i found this helpfully tutorial for realize drag an drop with nstabelview: https://drive.google.com/open?id=0B8PBtMQt9GdONzV3emZGQWUtdmM
this works fine.
but i would like to split both table views into differente view controllers and classes with a split view:
one split view controller:
- item 1: viewcontroller with source nstableview (SourceTableView.class)
- item 2: viewcontroller with target nstableview (TargetTableView.class)
how can i do this with this project? i know how can i create a split view controller in storyboard. but i dont know, if i have two different classes, how the iBoutlet SourceTabelView of class SourceTableView.class assign the iBoutlet TargetTableView of class TargetTableView.class
UPDATE
var person = [Person]()
NSManagedObject.class
import Foundation
import CoreData
@objc(Person)
public class Person: NSManagedObject {
@NSManaged public var firstName: String
@NSManaged public var secondName: String
}
Example of drag and drop between two table views inside a split view. Dragging inside one table view and multiple selection will work. Hold the Option key to drag a copy.
The datasource of each table view is the view controller inside the split view. Each table view has its own view controller and each view controller controls one table view. Both view controllers are the same
NSViewController
subclass:To make dragging to the trash work, subclass
NSTableView
and override:p.s. I'm not familiar with Swift and had some trouble with arrays and indexsets so I used
NSMutableArray
andNSIndexSet
.