I want to make a list with multiple section headers and items based on a date field of a list of items. What is the best way to do this programmatically?
var registrants:[Registration] = [Registration(name:"Joe", date:12/15/2020),Registration(name:"Billy", date:11/12/2020),Registration(name:"Cameron", date:11/10/2020)]
Usually I hardcode and use only foreach loop for items in one specific section like the following:
List {
Section(header: Text("December 2020")) {
ForEach(...)
}
Section(header: Text("November 2020")) {
ForEach(...)
}
Section(header: Text("October 2020")) {
ForEach(...)
}
}
Am looking for a smarter way to do this...