Post

Replies

Boosts

Views

Activity

Reply to SwiftUI TextEditor .background()
with iOS 16 you need to use scrollContentBackground. A user on SO created an extension method to handle both cases: https://stackoverflow.com/a/75910933/69144 I verified this worked for me code from their answer below: struct ContentView: View { @State private var editingText: String = "" var body: some View { TextEditor(text: $editingText) .transparentScrolling() .background(Color.red) } } public extension View { func transparentScrolling() -> some View { if #available(iOS 16.0, *) { return scrollContentBackground(.hidden) } else { return onAppear { UITextView.appearance().backgroundColor = .clear } } } }
Jan ’24