Questions tagged [lazyvgrid]
131 questions
4
votes
2 answers
Center the last row in a LazyVGrid
In a LazyVGrid, I show data coming from the server (here I'm using the alphabet as an example), and my goal is to show the last row in a center instead of leading if the last row contains less than 3 items. Is it doable?
Currently, it looks like…

Harshil Patel
- 1,318
- 1
- 7
- 26
4
votes
0 answers
How to make LazyVGrid not to be lazy?
Inside my ScrollView, there is LazyVGrid view on the top of other View. After scrolling to bottom, when I scroll to top slowly, I notice that LazyVGrid view disappears for a while. Here is my snapshot (https://i.stack.imgur.com/uDLZ2.jpg)
struct…

Dscyre Scotti
- 1,307
- 10
- 17
3
votes
0 answers
Performance Issue when using LazyVGrid
I have a very simple app: 4,000 images(400x400 in .jpg) that need to display 3 in a row. All images a stored in file storage and are equal 1/3 of device width so I don't need to resize/rescale it but display as is.
Here is a body code:
var body:…

Serge
- 2,031
- 3
- 33
- 56
3
votes
1 answer
Multiple vertical ScrollViews in one SwiftUI view
I am trying to implement a tab-layout LazyVGrid that will contain three different data types. For this, I have taken a Single scrollView and have created multiple LazyVGrid to accommodate this data.
The problem I am facing is, that whenever a list…

Pankaj Gaikar
- 2,357
- 1
- 23
- 29
3
votes
0 answers
swiftui freeze when scroll too fast in scrollview with lazyvgrid
I have a widget list in scrollview, each row have 3 elements. Some elements will show a stopwatch by SwiftUI Text timer. The Text timer will increase by 1 every second. Every thing work well at first, but If I scroll the list too fast, the Text…

mars
- 109
- 5
- 21
3
votes
1 answer
Building a lazy grid with rows and columns - SwiftUI
I am wanting to create a view in my app which acts basically as a table. I believe a lazy grid is the best way to do this in iOS 14, I'm just not sure what I am doing with them. The sort of table I want to create is pictured below:
Each of the rows…

benpomeroy9
- 375
- 5
- 21
3
votes
1 answer
SwiftUI grid with column that fits content?
Is this layout possible with SwiftUI?
I want the first column to wrap the size of the labels, so in this case it will be just big enough to show "Bigger Label:". Then give the rest of the space to the second column.
This layout is pretty simple…

Rob N
- 15,024
- 17
- 92
- 165
2
votes
1 answer
How can I add padding to a SwiftUI View's context menu preview?
I have a LazyVGrid with items in it, I don't have any padding on the items because I prefer to let the layout of the LazyVGrid manage the spacing between cells. but when I open the context menu on the item it displays the item as it is with no…

Halpo
- 2,982
- 3
- 25
- 54
2
votes
1 answer
SwiftUI - How to make grid items fill available space
I am trying to create a 3x4 grid. Each grid item should be the same size. Together the items should fill the entire view (excluding top navigation bar). The grid should be flexible so it stretches or shrinks depending on the size of the view.
So…

IamActuallyIronMan
- 75
- 7
2
votes
1 answer
Full span(width) view in n'th index of LazyVGrid with 2 columns SwiftUI
I have a LazyVGrid with 2 columns in my ContentView.
I want to add full width item on every n'th index of the grid.
In this code snippet I am trying to add full width item only in the 2nd position for testing.
How can I achieve this ?
Thanks in…

Akhil
- 93
- 7
2
votes
1 answer
SwiftUI: Expand LazyVGrid cells to max height of each row
I'm using a LazyVGrid in a ScrollView to display cells in either a 1 (portrait) or 2 (landscape) column layout. However, the height of shorter cells in a row does not expand to match the taller cell in the same row and looks pretty terrible.
How can…

Naren Hazareesingh
- 21
- 1
2
votes
1 answer
An interesting animation with SwiftUI's LazyVGrid on multiple items insert and remove
I have a button where let the user see some more of the items on tap. Initially it's shows of 4 items. After tap, I add rest of the items to the list and for less, I just show the first 4 items. The default animation gets weird every time playing…

nesimtunc
- 849
- 7
- 28
2
votes
0 answers
LazyVGrid content does not conform to transition animation
I have a simple code where I have a button on the screen. When the button is pressed a red rectangle with some buttons should slide/transition from bottom of the screen and appear.
The problem is that the background (the red rectangle) is sliding…

Theodor Ungureanu
- 233
- 1
- 7
2
votes
1 answer
SwiftUI LazyVGrid missing some content
I have been experimenting with LazyVGrid to produce a table with grid lines. I'm using XCode 13.4 & iOS15. Everything seemed to be going well until I parameterized all the column sizes, line widths, etc. The content consists of an array of row data…

apps2go
- 86
- 1
- 6
2
votes
1 answer
How to trigger a NavigationLink programmatically in a LazyVGrid
I have a LazyVGrid inside a NavigationView.
NavigationView {
ScrollView {
LazyVGrid(columns: columns) {
ForEach(items) { item in
NavigationLink(tag: item, selection: $displayedItem) {
…

Mischa
- 15,816
- 8
- 59
- 117