I am using the following code to support NSTableCellView height grow while editing the cell. The cell contains custom NSTextField where I override intrinsicContentSize:
override var intrinsicContentSize: NSSize {
if !isEditable {
return super.intrinsicContentSize
}
if let txt = self.window?.fieldEditor(false, for: self) as? NSTextView {
if let container = txt.textContainer {
if let layoutManager = container.layoutManager {
layoutManager.ensureLayout(for: container)
let size = layoutManager.usedRect(for: container).size
return NSMakeSize(NSView.noIntrinsicMetric, size.height)
}
}
}
return super.intrinsicContentSize
}
container.layoutManager always returns nil in Big Sur, and it cause the cell to stay a single line while editing, while it is not nil in Catalina and the cell grows as expected.
Would appreciate any clue in fixing this issue.