Hi,
I'm trying to make a small text editor. Everything works except I need the background a different color.
But the standard way to do it with 'ZStack' doesn't work? Any ideas?
Thanks!
I'm trying to make a small text editor. Everything works except I need the background a different color.
But the standard way to do it with 'ZStack' doesn't work? Any ideas?
Thanks!
Code Block ZStack { Color.green .ignoresSafeArea() NavigationView { TextEditor(text: $text) .background(Color.clear) .navigationTitle("Notepad Test!") } } }
try this:
or this, if you only want the text editor background color:
Code Block struct ContentView: View { @State var text = "start text" init() { UITextView.appearance().backgroundColor = .clear } var body: some View { NavigationView { ZStack { Color.green.ignoresSafeArea() TextEditor(text: $text) } .navigationTitle("Notepad Test!") } } }
or this, if you only want the text editor background color:
Code Block struct ContentView: View { @State var text = "start text" var body: some View { NavigationView { TextEditor(text: $text).padding().colorMultiply(.green) .navigationTitle("Notepad Test!") } } }