Post

Replies

Boosts

Views

Activity

Comment on MacOs - NSTableView, editing single cell
Here is the ViewController code for a test project that demonstrates the issue I'm having with my actual project: (Is there a way to attach the entire Xcode project?) `// //  ViewController.swift //  TEST // //  Created by Phil Bond on 9/13/21. // import Cocoa class ViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSource {     var infoForTableView : [String] = ["one", "two", "three", "four", "five"]     override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view.     }     override var representedObject: Any? {         didSet {         // Update the view, if already loaded.         }     }          @IBAction func cellWasEdited(_ sender: NSTextFieldCell) {         print("cell was edited")         print(sender.stringValue)     }           func numberOfRows(in tableView: NSTableView) -> Int {     return infoForTableView.count     }          func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {         return infoForTableView[row]     } } `
Sep ’21
Comment on MacOs - NSTableView, editing single cell
@Claud31 thanks. Yes, the delegate (and datasource) have been set for the TableView to my ViewController. I'll add that the tableview is cell based. For my action I've tried NSTextField, NSTextFieldCell and even Any – with no success. My IBAction code (there's nothing in it yet): @IBAction func cellWasEdited(_ sender : NSTextFieldCell) { print("cell was edited") }
Sep ’21