I am new to OSX coding and coding a mac OS app.
How can I access the text from rows that the user has selected. In this particular case, I am allowing users to select multiple rows to delete from the database in one go and is why I need to retrieve the text that I'm using as keys in the database.
Working in the console screen, here is a simplified version of what I'm tring to do.
import Cocoa
import Foundation
extension MainViewController {
func tableViewSelectionDidChange(_ notification: Notification) {
let myColumn = 0 // -- first column
let myRow = tableViewFolders.selectedRow // -- row int index clicked
let myCell:String = "?" // -- ?get row or cell as string and/or array
print("myColumn: \(myColumn)")
print("myRow: \(myRow)")
print("myCell: \(myCell)")
}
Here is the simplest form of an answer I was able to figure out. This is only one column but I see no reason it would not work for multi-column tables. You'd have to access each column element using a column index after retrieving the row.
In a nutshell, I have an in-memory array.
That array has been loaded into a tableView. Here is the code to get the rows that the user has hilited and do something with those rows. Here I am just printint it to the console.