Questions tagged [lazyvgrid]
131 questions
0
votes
1 answer
ScrollView memory issue by adding .content - SwiftUi
For populating ScrollView with a large amount of data, apple is suggesting using LazyVGrid inside the ScrollView: LazyVGrid - Apple
So this sample code that is loading 500 random photos works perfectly in case of memory management: (Almost 30MB).
I…

Sajjad Sarkoobi
- 827
- 8
- 18
0
votes
0 answers
How to know the current position in a LazyVGrid in SwiftUI
I'm presenting a dynamic table that can expand from the top or bottom. When presenting data in a combination of ScrollView and LazyVGrid, if I add more data to the bottom the scroll view doesn't change (this is what I want). However when data is…

Felipe Arrudi
- 43
- 3
0
votes
0 answers
LazyGridView how to detect and act on item overflowing screen?
I have a grid of items. Each item can expand height. I want to autoscroll when the item is expanded so it doesn't overflow the screen.
I was successful with the following code but I had to revert to a hack.
The idea was to detect when the item is…

GrandSteph
- 2,053
- 1
- 16
- 23
0
votes
1 answer
Text view is not show in LazyVGrid
I experience kind of weird behavior of placing Text view in nested ForEach in one LazyVGrid view. My code look like this
LazyVGrid(columns: dataColumns) {
ForEach(months, id: \.self) { month in
Text("\(dateFormatter.string(from:…

Dawy
- 770
- 6
- 23
0
votes
0 answers
SwiftUI LazyVGrid Layout Issue Between iOS and macOS
I'm currently working on a multiplatform app for both iOS and macOS with SwiftUI, and I'm having a layout issue with the LazyVGrid. Below is my grid implementation, and screenshots from both iOS and macOS showing the issue I'm encountering:
struct…

RPK
- 1,830
- 14
- 30
0
votes
0 answers
Make a grid with te second column padding top in swiftUI
I want to create a grid that is like in a zig-zag formationlike in the image below:
What I have tried is a lazyVGrid but I am struggling to customize it.
Is it possible to get the grid to look like that and how would I implement something like…

Pieter Venter
- 43
- 1
- 11
0
votes
1 answer
SwiftUI - How to handle drop event outside of my View
I'm implementing drag & drop in LazyVGrid. I'd like to call some function when drop happens outside of my View. How can I get the callback?
Here is my code:
var body: some View {
LazyVGrid(columns: ...) {
ForEach(...) { item in
…

Levan Karanadze
- 739
- 1
- 11
- 21
0
votes
1 answer
While using a ForEach nested in a LazyVGrid how can I implement usable play buttons that navigate to a different view?
I have created a scrollable grid view where each icon is supposed to represent a different playlist. I implemented a play button using a navigation link for each playlist in the left corner however, for some reason, the play button is not usable. It…

steeezyboy
- 31
- 4
0
votes
1 answer
How can implement a navigationLink inside of a LazyVGrid and ForEach statement?
How can I implement play buttons that navigate to different views in the corner of each music category item? Here is an image of what I am looking for:
Here is my code:
struct ScrollCategories: View {
var body: some View {
ZStack…

steeezyboy
- 31
- 4
0
votes
1 answer
Reusing Swift UI LazyVGrid is destroying the frames of grid item
I have tow view FolderView and FilesView
struct FoldersView: View {
var folderData : [FolderModel]?
var body: some View {
ScrollView {
LazyVGrid(columns: SizeConfig.GridLayout.adaptiveGridItemLayout_170) {
if let foldersObj…

Vikash Kumar Chaubey
- 117
- 8
0
votes
1 answer
SwiftUI Make LazyVGrid Width Fill The screen Inside HStack
I try to have three LazyVGrid inside HStack and each one has the width of the screen, so the middle one will appear and the other two once will became on the left and right of the screen (as shown in the picture below), the problem that it's not fit…

Ammar Ahmad
- 534
- 5
- 24
0
votes
1 answer
Grid layout that puts things in column order
I have the code below which works great. It displays words in alphabetical order in a nice grid. And it works great on different devices, iphone, ipad. Eg, when rotating an ipad from portrait to landscape, I get more columns. It fills the screen no…

Jack
- 2,206
- 3
- 18
- 25
0
votes
0 answers
SwiftUI LazyVGrid Cropping Views
I have a LazyVGrid that contains 5 columns. I have set the maxWidth to the geometry width which seems to work, however the LazyVGrid doesn't seem to respect this width and is cropping subviews. Is there any way around this?
This code:
struct…

Brandon Stillitano
- 1,304
- 8
- 27
0
votes
2 answers
How to properly fit a filled Image in its bounds on SwiftUI?
I have to fix a problem with Images on SwiftUI. I currently have to fill the images I receive in a certain vertical container, which are the cells of a LazyVGrid, but the problem is that the tappable area expands over the designated one.
I used the…

Alessandro Francucci
- 1,528
- 17
- 25
0
votes
1 answer
LazyVGrid inside a VStack inside a ScrollView among other elements causes a crash
Here's my view's code:
ScrollView {
VStack {
someView
LazyVGrid(
columns: [
GridItem(
.adaptive(minimum: metrics.size.width / 2),
spacing: 0
)
…

Tamás Sengel
- 55,884
- 29
- 169
- 223