Given a list of numbers which is required to display as a list of rows of 7 elements (consider days in calendar iOS app), is it possible to conditionally wrap HStack
in VStack
if a number divides by modulo, for example?
VStack(alignment: .center, spacing: 10) {
ForEach(1...self.getDays(), id: \.self) { day in
// something like if (day % 7 == 0) { VStack
HStack(alignment: .center, spacing: 10) {
DayView(dayNumber: day)
}
}
}
Or, perhaps it is possible to apply the group by every 7 elements in the list, without ViewBuilder?