📜  对于每个 swiftui - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:03.089000             🧑  作者: Mango

代码示例2
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)
            }
        }
    }
}