Below code results in the List occupying almost all of the height of the screen. How do I ensure that the List only occupies the bare minimum required height which can be dynamic depending upon the number of rows. Simulator screen shot attached for your reference. Thanks!
// om namah shivaya
import SwiftUI
struct TestView: View {
@State private var name = ""
var body: some View {
VStack(spacing: 0) {
Spacer()
Text("Header")
List() {
TextField("enter your name", text: $name)
}
.listStyle(InsetGroupedListStyle())
Text("Footer")
Spacer()
}
.navigationTitle("Test")
.background(Color.red)
}
}
struct TestView_Previews: PreviewProvider {
static var previews: some View {
TestView()
}
}
