I know how to make a tableview user-click sortable but how to sort it programmatically (without using an NSArrayController)? The docs are skimpy on this. Here is what I got:
private func updateThemeTableView()
{
_tableViewDataDict = getAssociatedThemesFor(_type);
_tableView.reloadData();
let sort = NSSortDescriptor(key: "Theme", ascending: true, selector: "caseInsensitiveCompare:");
_tableView.sortDescriptors = [sort];
}
But this doesn't work.
What is the key used here? Should this be the table view column name or the column identifier (set in IB)?
When to apply the sort? (I suppose after _tableViewDataDict received the data and reloadData(), whereafter NSTableViewDataSource.viewForTableColumn() does its business?)
Is the sort selector valid or do I have to provide a method for this?