This magic is frustrating when it does not work.
I have a SwiftUI view (PhysicalSize) wrapped in NSHostingView that is placed inside a NSTableCellView.
I have set a custom NSTableRowView on the NSTableView and AppKit is setting the proper isEmphasized status when the row is selected.
Good.
Then I'm setting the backgroundStyle of the cells to .emphasized
Good.
However the swift UI is absolutely unaware, that we are being drawn in highlighted mode and the Text color does invert. Not good.
Can some apple genius chime in here.
struct PhysicalSize: View {
var file: File
var body: some View {
HStack {
Spacer()
Text(file.physicalSize.compactFormatted)
.font(.subheadline)
}
}
}
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: