Giving List
a set of items seems to make it incorrectly treat Section
as a single view.
You should probably file a radar for this, but in the meantime, this will give you the behavior you’re looking for:
struct ListView : View {
let mygroups = [
TestData(title: "Numbers", items: ["1","2","3"]),
TestData(title: "Letters", items: ["A","B","C"]),
TestData(title: "Symbols", items: ["€","%","&"])
]
var body: some View {
List {
ForEach(mygroups) { gr in
Section(header: Text(gr.title),
footer: Text("...footer...") ) {
ForEach(gr.items.identified(by: \.self)) { item in
Text(item)
}
}
}
}
}
}