To allow a TextField to adjust its height automatically according to its content, set the .fixedSize(horizontal: false, vertical: true)
modifier to it. This will cause the text field to wrap its contents vertically and grow or shrink dynamically based on the size of the text entered. For example:
TextField("Enter some text...", text: $text)
.textFieldStyle(RoundedBorderTextFieldStyle())
.fixedSize(horizontal: false, vertical: true)
Asked: 2022-08-31 11:00:00 +0000
Seen: 11 times
Last updated: Sep 08 '21