Using an IBAction ...(_ sender: NSButton) getting the state to change a bool. However setting the state initially whilst populating a table gives oposite results ...
@IBAction func addCheckValue(_ sender: NSButton) {
let object_row = tableView.row(for: sender)
lt state = sender.state
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
...
if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "identCellAdd"), owner: nil) as? NSTableCellView {
if let button = (cell.subviews[0] as? NSButton) {
button.state = file.add ? NSControl.StateValue.on : NSControl.StateValue.off
}
return cell
If the state is on the action's state will be normal 1 on 0 off, but if it is off 1 becomes off and 0 on.