I use 2 foreach loops in my widget body, which slow down the performance (Code completion is slow). Also there are many HStacks and VStacks. Is there a way around this?
ForEach(0..<data.eventsToday.count)
{(row) in
if row < 3 {
HStack{
Rectangle().fill(eventBgColor)
.frame(width: 6, height: 25, alignment: .leading)
.cornerRadius(3.0)
VStack{
Text(data.eventsToday[row].title)
.font(eventFont)
.multilineTextAlignment(.leading)
.frame(width: 120.0, height: 14.0, alignment: .bottomLeading)
.truncationMode(/*@START_MENU_TOKEN@*/.tail/*@END_MENU_TOKEN@*/).lineLimit(1)
.foregroundColor(titleColor)
Text("\(String(MediumWidget2GetStartTime(indexRow:row)))")
.font(timeFont)
.multilineTextAlignment(.leading)
.frame(width: 120.0, height: 11.0, alignment: .bottomLeading)
.lineLimit(1)
.foregroundColor(timeColor)
}
}.padding(.bottom, 5.0)
}
}