In SwiftUI I'm trying to get my TextEditor
content into leading alignment with the Text
above it. I have a pattern to do this in UIKit but can't seem to find the correct modifiers in SwiftUI.
In the attached screenshot, I'd like the text origin to be (0,0). Not... (6, 12), roughly.
Implementation Code:
struct AttributedTraitField: View {
let name: String
@State private var value: String = "Placeholder"
var body: some View {
VStack(alignment: .leading, spacing: 0.0) {
Text(name)
.background(Color.blue)
TextEditor(text: $value)
}
.padding(.all)
.background(Color.green)
}
}