Reputation: 11436
in case of create the List with Swift UI I have uncontrollable background of the List
Looks like there is absent "native" way to change background color of List background color.
How to make it transparent?
(Answer is below)
Upvotes: 1
Views: 2458
Reputation: 11436
the following code makes ALL OF List
s background color transparent:
// Removes background from List in SwiftUI
extension NSTableView {
open override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
backgroundColor = NSColor.clear
enclosingScrollView!.drawsBackground = false
}
}
the following code makes ALL OF TextEditor
s background color transparent:
extension NSTextView {
open override var frame: CGRect {
didSet {
backgroundColor = .clear //<<here clear
drawsBackground = true
}
}
}
Upvotes: 5