I am creating a screen using a Form, with one TextField and one textEditor. Here is my code:
struct AddIssueView: View {
@State var title = ""
@State var description = "Enter issue description"
var body: some View {
NavigationView {
Form {
Section(header: Text("Title")) {
TextField("Enter issue title", text: $title)
}
Section(header: Text("Description")) {
TextEditor(text: $description)
}
.navigationTitle("New Issue")
}
}
}
}
This is the resulting screen - I find it surprising that the TextEditor UI looks like the TextField UI - I expected to see a multi-line text area. I'm not sure what I'm missing - any help will be most appreciated.
Set the frame size on the TextEditor. Here are values I'm using in a project. Fiddle around with the values to get the size you'd like.
TextEditor(text: $postBody)
.frame(minWidth: 200,
idealWidth: 250,
maxWidth: 400,
minHeight: 300,
idealHeight: 325,
maxHeight: .infinity,
alignment: .center)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With