Reading time: 1 min

This recipe shows how to change TextEditor background color in SwiftUI.

The end result looks like this:


This feature is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

The trick is to do the same thing we did for changing List background color: set scrollContentBackground to hidden:

TextEditor(text: $text)
  .scrollContentBackground(.hidden) // HERE

Next Post Previous Post