I ran into this too, but managed to find a solution.
The updateNSView method. was getting called very frequently and so reloading the table which lost the section.
I made this function check if its data had changed before reloading and that worked.
I had passed the data to the Coordinator for use in the data source & delegate, so this code worked for me:
func updateNSView(_ nsView: NSTableView, context: Context) {
if tableData != context.coordinator.tableData {
context.coordinator.tableData = tableData
nsView.reloadData()
}
}
The elements in my data array were already Equatable, so this works fine.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: