Hello toegetier,
i do have a Form
VStack {
Form {
Section(header: Text("Select Your Home Club")) {
Picker ("Club", selection: $club) {
if club == nil {
Text("select club").tag(Optional<String>(nil))
}
ForEach(model.clubs.sorted()) { arg in
HStack {
if let logo = arg.clubLogoUrl {
ImageView(url: logo, key: logo, width: 28, height: 28)
.scaledToFit()
.padding(.trailing)
} else {
Text("")
.frame(width:28, height:28)
.padding(.trailing)
}
Text(" \(arg.name)")
}.tag(Optional(arg.name))
}
}
.pickerStyle(.menu)
}
Section(header: Text("Select Your Home Ballpark")) {
Picker ("Ballpark", selection: $stadium) {
if stadium == nil {
Text("select ballpark").tag(Optional<Ballpark>(nil))
}
ForEach(model.ballparks.sorted()) { arg in
Text(arg.name).tag(Optional(arg))
}
}
.pickerStyle(.menu)
}
.onChange(of: stadium, initial: true) {
self.homeBallpark = stadium?.name ?? ""
print("homeBallpark: \(homeBallpark)")
}
}.border(Color.blue)
//.frame(height: 225)
Spacer()
MapView(poi: stadium)
.cornerRadius(10)
.padding(.all)
}
as we all know, the Form takes all available vertical space. Without the .frame()-modifier, the result looks like:
What I want is, that the Map-View is shown below the form and that the form changes it’s height based on it’s content:
I can only achieve this result by adding a .frame-modifier with an explicit number for its height. But that’s absolutely not the way how it should work. This maybe works right now, but this is not the intended dynamical change of content by Swiftui.
Does anyone has experience with such a topic? how can I solve this issue?
Thanks and best regards
Peter