Skip to content

Instantly share code, notes, and snippets.

@fitomad

fitomad/lazyhgrid_snippet.swift Secret

Created Jun 23, 2020
Embed
What would you like to do?
internal struct HorizontalGridView: View
{
//Definimos las filas que tendrá cada columna
var rows: [GridItem] = Array(repeating: .init(.flexible()), count: 5)
internal var body: some View
{
ScrollView([ .horizontal ], showsIndicators: false)
{
LazyHGrid(rows: rows, alignment: .center, spacing: 8)
{
ForEach(0 ..< 43) { number in
Text("\(number)")
.font(.title)
.frame(width: 100)
.frame(maxHeight: .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.