It seems I cannot find a solution how to get value out of a textfield in tableview. Hope I can describe my problem accordingly. Here are two pictures of my setup in IB:
I have subclassed NSTextField in order to draw a new background. This is working so far. But coming to the challenge to get the cells value as a variable, I can´t find a solution. The cell is getting it´s value out of a NSArrayController binding. I tried with self.objectValue
, self.stringValue
I´m always getting nil. Making an outlet is not possible as well.
Here´s the code of my subclass:
class ProgressView: NSTextField {
func getOwnValue() {
// Here I´m getting always nil
let ownValue = self.objectValue
let ownValue2 = self.stringValue
}
}
What am I missing? Help would be much appreciated.
found the solution:
override var stringValue: String {
didSet {
Swift.print(stringValue)
}
}