NSTableView doesn't update row height while typing in NSTextField inside a cell

So I have an NSTableView with automatic row heights whose cells contain a self-sizing NSTextField. The row height adjusts after I finish typing in NSTextField (press enter), but not during, and I need it to adjust during typing as well.

Here's the code for the self-sizing NSTextField:
Code Block swift
override var intrinsicContentSize: NSSize {
// Guard the cell exists and wraps
guard let cell = self.cell, cell.wraps else {return super.intrinsicContentSize}
// Use intrinsic width to jive with autolayout
let width = super.intrinsicContentSize.width
// Set the frame height to a reasonable number
self.frame.size.height = 750.0
// Calcuate height
let height = cell.cellSize(forBounds: self.frame).height
return NSMakeSize(width, height);
}
override func textDidChange(_ notification: Notification) {
super.textDidChange(notification)
super.invalidateIntrinsicContentSize()
}

The only customization for NSTableView is this line:
Code Block swift
tableView.usesAutomaticRowHeights = true

Thanks in advance!


NSTableView doesn't update row height while typing in NSTextField inside a cell
 
 
Q