I would like to add copy (Command + C) functionality to my NSTableView for a row (or multiple rows) that the user has selected. Based on what I read the copy functionality in the Menu Item should be active automatically if you implement copy in your TableView Controller Delegate.
I've tried adding in the NSTableViewController (is the delegate and data source of the table view) the following things with no luck, the copy menu item still appears greyed out:
- override func copy() -> AnyObject { print("TEST: copytriggered") /Here i would copy to clipboard the selected rows/ return true }
2. Conforming to NSCopying, implementing copyWithZone...
3. Trying 1 and 2 in the window controller and app delegate.
- Adding func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? in the TableView data source.
I have no clue what to do at this point, any help appreciated.
Thanks,
Marc