How to layout views in SwiftUI in such way
- I have input fields that I want to stretch to fill available space
- This inputs are placed in VStack in such way that I am giving them
frame(height: 40)
- This VStack is inside white box which has
frame(maxHeight: geometry.size.height * 0.8)
And the last white box is not adjusting to number of inputs in for VStack but rather takes 0.8 space and then this inputs are spread inside VStack instead (more spacing than needed is added.
I do not understand why such thing is happening.
FormView()
.frame(
maxWidth: geometry.size.width * 0.85,
maxHeight: geometry.size.height*0.85
)
Form View contains:
VStack(spacing: 4) {
FormInput(label: "First Name", input: self.$firstName) {
isEditing in
self.avoider.editingField = 0
}
.frame(height: 40)
.padding(0)
.avoidKeyboard(tag: 0)