Scenario: A cell-based NSTableView
has columns bound to keys of dictionaries from an array controller. When the user double clicks a cell, it is edited in the normal way -- all with the default functionality of table views and array controllers.
This works fine as long as the dictionaries for each row hold strings as values for the various keys.
If I set a value to an NSNumber
in the dictionaries, it is displayed correctly, but upon editing it gets set to an NSString
.
What would be the best way to set up the table view, data source, delegate, and array controller to ensure that the values are updated to new objects of the same class as was used before the editing?
You can attach a custom subclass of NSValueTransformer
to the table column to ensure that the values in the column are always saved as NSNumbers
.