I have a NSTableView
with bindings.
Each row of the table is a Core Data Entity named Entry
.
An Entry
can have several CustomValue
. Each CustomValue
should be displayed in its own column in the Table.
I had 2 choices to model this in Core Data:
- Choice 1: Either model a dictionary as a Transformable, where the key is the column name & the value is the CustomValue.
- Choice 2: Either use a To-Many relation ship Entry <-->> CustomValue <--> key & value where key is a
Column
entity.
I chose the second solution based on this: Best practice? - Array/Dictionary as a Core Data Entity Attribute
BUT my problem is : with Choice 2, how can I bind the data to the column? With Choice 1, I could do something like this:
textField.bind(NSBindingName.value, to: cellView, withKeyPath: "objectValue.myDictionary.\(tableColumn!.identifier.rawValue).value", options: nil)
I'm currently stuck, I need to map a binding to something that would allow me to search for the proper value based on the key.
Any idea? Thanks in advance :-)