I try to build a view in SwiftUI with 2 views vertically arranged. i can not have the top view smaller than the bottom view.
import SwiftUI
struct SettingList: View {
@State var texte: String = "tttttttttttttttt"
var body: some View {
VStack{
List {
Section {
HStack {
Text("bbb")
Spacer()
TextField("texte : ", text: $texte)
}
HStack {
Text("bbb")
Spacer()
TextField("texte : ", text: $texte)
}
HStack {
Text("bbb")
Spacer()
TextField("texte : ", text: $texte)
}
} header: {
Text("Settings")
.font(.title)
}
}
List {
Section {
ForEach(0..<26) { i in
Text("Placeholder \(i)")
}
} header: {
Text("List")
.font(.title)
}
.font(.title2)
}
}
}
}
struct SettingList_Previews: PreviewProvider {
static var previews: some View {
SettingList()
}
}
What I get is that the 2 List in th VStacvk have same height. I would like to have the top one use only space needed for the (3 in this examples) lines with no scrolling , while bottom can take the other part of the view and be able to scroll.
I tried with fixedSize() but could not get better results.
Have you any idea ? Thanks for your time.