我想在 macOS 上更改 SwiftUI 文本编辑器的背景颜色。下面的代码(用于 iOS)是否有适用于 NSTextField 而不是 UITextView 的变体?
谢谢。
struct ContentView: View {
init() {
UITextView.appearance().backgroundColor = .clear
}
var body: some View {
TextEditor(text: .constant("Placeholder"))
.background(Color.red)
}
}
Run Code Online (Sandbox Code Playgroud)