swiftui foreach
ForEach(1...5) { row in
Text("Row \(row)")
}
Mobile Star
ForEach(1...5) { row in
Text("Row \(row)")
}
struct ContentView: View {
let colors: [Color] = [.red, .green, .blue]
var body: some View {
VStack {
ForEach(colors, id: \.self) { color in
Text(color.description.capitalized)
.padding()
.background(color)
}
}
}
}