I have a macOS tableview I have a textfield as a column along with an IBAction code to capture the data from this field. I wanted to add continuous spell check for this column . So, I decided to change the column from a TextField to a ScrollView to take advantage of the continuous spell check. Using Xcode 14 I changed the Cell to a custom Cell. The custom cell has a scrollview object as the object because I want to take advantage of the built in continuous spell checking instead of using a textfield. All is well with this implementation until I tried to add a IBAction code for when I enter text in the scrollview/textView field.
There does not seem to be a way to capture the text? Am I trying to do something that can't be done or is there a way to add continuous spell check to a textField?
To get access from the VC, you should, in the VC:
- create an IBOutlet for the tableView (not its container ScrollView)
- get a reference to the cell, with something like (adapt row and column values)
guard let cell = tableView.view(atColumn: 0, row: 0, makeIfNecessary: true) as? CustomTableCell else { return }
- then use the cell to access any component you need:
let text = cell.testTextView.textStorage?.string