Skip to content

Instantly share code, notes, and snippets.

@fitomad

fitomad/lazyvgrid_snippet.swift Secret

Created Jun 23, 2020
Embed
What would you like to do?
internal struct VerticalGridView: View
{
// Definición de las columnas que tendrá cada fila
var columns: [GridItem] = Array(repeating: .init(.flexible()), count: 3)
internal var body: some View
{
ScrollView([ .vertical ], showsIndicators: false)
{
LazyVGrid(columns: columns, alignment: .center, spacing: 8)
{
ForEach(0 ..< 44) { number in
Text("\(number)")
.font(.title)
.frame(height: 100)
.frame(maxWidth: .infinity)
.background(number.isEven ? Color.orange : Color.purple)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.