I there anyway to combine a List and say Form view on the same screen? or do you have to have one or the other and manually build the rest?
I have this code, and each component the list and the form, are scrolling independently and also very spaced apart..
var body: some View {
VStack(spacing: 0) {
Form {
Text(orgEntity.name)
Text(orgEntity.address)
}
.padding([.bottom], 20)
List {
ForEach(0...3, id: .self ) { int in
Text("List Test (int)")
}
}
.navigationTitle("(orgEntity.name)")
}
}
}
2
Answers
Don’t use list: place everything in the
Form
withSection
s, like this:If you want to keep the stationary form and still have a scrolling list then a frame(height:) can be used on the Form:
Result:
Example code: