I want to display some images that depend on an integer.
Example with '3':
VStack {
Text(recette.name)
HStack() {
Text("Durée 20 min")
.font(.caption)
.fontWeight(.light)
Text("Notes")
.font(.caption)
.fontWeight(.light)
HStack(spacing: -1.0) {
for 0 in 0...recette.avis{
Image(systemName: "star.fill")
.padding(.leading)
.imageScale(.small)
.foregroundColor(.yellow)
}
}
}
}
but the code doesn't compile with this error in for.
Closure containing control flow statement cannot be used with function builder 'ViewBuilder'
Can somebody help me ?
Thank you.