Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created June 23, 2020 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/2fab102398cf7f7f5009805465e87ac7 to your computer and use it in GitHub Desktop.
Save fitomad/2fab102398cf7f7f5009805465e87ac7 to your computer and use it in GitHub Desktop.
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