Created
December 19, 2023 10:07
-
-
Save IntegerOverlord/3bba7f39e884f0e8b5fe53a121af35d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
let data = (1...10000).map { "Item \($0)" } | |
let columns = [ | |
GridItem(.flexible()), | |
GridItem(.flexible()), | |
GridItem(.flexible()) | |
] | |
var body: some View { | |
ScrollView { | |
LazyVGrid(columns: columns, spacing: 20) { | |
ForEach(data, id: \.self) { item in | |
ViewThatFits { | |
ZStack { | |
Rectangle() | |
.foregroundStyle(.blue) | |
Text(item) | |
.foregroundStyle(.white) | |
} | |
EmptyView() | |
} | |
} | |
} | |
.padding(.horizontal) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment