Answers for "for each in swift"

1

for each swiftui

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)
            }
        }
    }
}
Posted by: Guest on January-07-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language