Reputation: 1668
I have two TextEditor
s in a VStack
in my app. I would like each of them to expand to fit the text they contain, but remain hugging the text. Unfortunately, long text in the first TextEditor
expands both TextEditor
s equally. It is as if the total height of the VStack
they are in is expanded correctly, but the extra height is shared between the two editors.
This only occurs when I use a maxWidth on the VStack. If I fix the width it behaves correctly.
Is there some way to solve this without losing the resize behaviour maxWidth gives?
ScrollView {
VStack(alignment: .leading) {
TextEditor(text: Binding($note.details)!)
.font(.body)
TextEditor(text: Binding($note.title)!)
.font(.title)
}.frame(maxWidth: 450)
}
Upvotes: 0
Views: 505
Reputation: 326
Try to put .fixedSize(horizontal: false, vertical: true)
on both editors.
Upvotes: 4