Skip to content

Instantly share code, notes, and snippets.

@leeyspaul
Created December 4, 2021 01:11
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 leeyspaul/e6d7364f78e8998ffc4f207edb394810 to your computer and use it in GitHub Desktop.
Save leeyspaul/e6d7364f78e8998ffc4f207edb394810 to your computer and use it in GitHub Desktop.
Calendar SwiftUI implementation using LazyVGrid
struct Calendar: View {
var cols: [GridItem] = [
GridItem(spacing: 35),
GridItem(spacing: 35),
GridItem(spacing: 35),
GridItem(spacing: 35),
GridItem(spacing: 35),
GridItem(spacing: 35),
GridItem(spacing: 35)
]
var body: some View {
VStack {
Text("December")
.font(.system(size: 30, weight: .bold))
LazyVGrid(columns: cols, spacing: 20) {
ForEach((1...31), id: \.self) { dayNum in
Text("\(dayNum)")
}
}
.frame(width: .infinity, height: 300)
.padding()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment