For now, I've just manually overriden the underlying UIKit element styling to allow for custom background support on the element, next to figure out how to pad the entry and set a placeholder.
Original fix can be found, as everything,
on StackOverflow.
Code Block swiftstruct MyView: View { |
@State private var name: String = "" |
@State private var description: String = "" |
|
init() { |
/* Override TextEditor background to allow for setting a custom background in SwiftUI */ |
UITextView.appearance().backgroundColor = .clear |
} |
|
var body: some View { |
NavigationView { |
Form { |
Section(header: Text("Details")) { |
TextField("Name", text: self.$name) |
|
TextEditor(text: self.$description) |
.background(Color(.secondarySystemGroupedBackground)) |
/* Set the background to that of the grouped background colour */ |
} |
} |
.navigationBarTitle("New Thing") |
} |
} |
} |
I'm trying to emulate the multiline edit field that is present in the Reminders app, where you set a title and description.
PS. Also Apple, fix your syntax highlighting in code blocks to support double forward slash...