Skip to content

Instantly share code, notes, and snippets.

@manojkarki
Created July 4, 2020 15:36
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 manojkarki/3fef7c309e21e928604ae6694798cba2 to your computer and use it in GitHub Desktop.
Save manojkarki/3fef7c309e21e928604ae6694798cba2 to your computer and use it in GitHub Desktop.
/*
Xcode 12.0 Beta 1
Scrolling vertically freezes the App
*/
struct VGridsExample: View {
private var data: [Int] {
(0 ... 2500).map {$0}
}
private var columns: [GridItem] {
Array(repeating: GridItem(.fixed(48),spacing: 0), count: 50)
}
var body: some View {
ScrollView([.horizontal, .vertical]) {
LazyVGrid(columns: columns, spacing: 0) {
ForEach(data, id: \.self) { index in
VGridItem()
}
}
}
}
}
struct VGridItem: View {
var body: some View {
Button {
} label: {
Text("B")
.foregroundColor(Color.green)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment