onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
669 stars 33 forks source link

How to clear TextEditor background in SwiftUI #920

Open onmyway133 opened 1 year ago

onmyway133 commented 1 year ago

For iOS 16 and macOS 13.0

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

For below, use [SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect)

TextEditor(text: $text)
    .instrospectTextView {
        $0.drawsBackground = false
    }