I am currently working on a MacOS project (Swift 4, Xcode 9) to shows different sets of data in one NSTableView, users can add, delete, and move around their created data sets, and everything is bound to core data through two array controllers via the NSTableView's bindings inspector sections (one to many between the column data entity and title/presets entity)
Unfortunately, the "Header Title" binding seems to be in the Column -> Binding inspector -> Parameter section, and is read only (based on Apple documentation).
As I've also implemented a custom TableHeaderCell class that allows the editing of the column's Header titles (field editor call in the NSTableView double click method), even if the cell is updated via the custom class, the header title binding will not update the array controller or core data.
Custom NSTableHeaderCell:
class CTableHeaderCell: NSTableHeaderCell, NSTextViewDelegate {
func textDidEndEditing(_ notification: Notification) {
guard let editor = notification.object as? NSTextView else {return}
self.title = editor.string
self.endEditing(editor)
}
At a loss on how to work around this issue.
I've tried moving the textDidEndEditing() function to the main ViewController (from the custom class) to allow the idenfication of the updated title, but that did not seem to work, and from what I've read the fieldeditor's delegate is set to the cell being edited.
I't doesn't seem like I can programmatically bind the item and change the read/write status, either?
I've been looking at key value observing (KVO), it looks like that would still mean manually updating the array controller or core data via a manual update?, after getting the new title which seems problematic if there is duplicate data.
Wondering if anyone has run across this problem, and/or knows of a solution?