Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created June 23, 2020 12:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/99866e9700d48ddb517bc28db36ca760 to your computer and use it in GitHub Desktop.
Save anupamchugh/99866e9700d48ddb517bc28db36ca760 to your computer and use it in GitHub Desktop.
struct ContentView: View {
let colors: [Color] = [.red, .green, .yellow, .blue]
var columns: [GridItem] =
Array(repeating: .init(.flexible(), alignment: .center), count: 3)
var body: some View {
ScrollView {
LazyVGrid(columns: columns, spacing: 10) {
ForEach(0...100, id: \.self) { index in
Text("Tab \(index)")
.frame(width: 110, height: 200)
.background(colors[index % colors.count])
.cornerRadius(8)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment