Questions tagged [lazyvgrid]
131 questions
0
votes
0 answers
SwiftUI: positioning a view using global frame information and animating to fullscreen?
I am trying to get familiar with LazyVGrid, layout and frames/coordinate spaces in SwiftUI and draw a grid that has 4 columns, each being 1/4 the width of the screen. On top of that, on cell tap, I want to place a view exactly over the tapped cell…

zumzum
- 17,984
- 26
- 111
- 172
0
votes
1 answer
How to put LazyVGrid next to Image swiftUI on MacOS (11.4)
(MacOS app)
I am trying to place a lazyvgrid next to an image. to have the image in a specific size and let the LazyVGrid take the rest of the width. I set the frame of the image but than the grid does not take the extra space and there are extra…

J. V.
- 366
- 3
- 9
0
votes
1 answer
Preview crashed after added LazyVGrid
I am learning Stanford CS193p, and everything went so well till switching LazyVGrid with HStack.
I checked my code with the one professor made, they are the same. But the confusing part of my code is that, when my emojiCount = 4, preview worked…

YephooShaw
- 3
- 2
0
votes
0 answers
Why does my SwiftUI Grid not adapt to the space available?
Why does my SwiftUI Grid not adapt to the space available? And how can I fix it?
I tried to follow and modify the code from Apple's WWDC video "Stacks, Grids, and Outlines in SwiftUI".
import SwiftUI
struct ContentView: View {
var body: some…

user14119170
- 1,191
- 3
- 8
- 21
0
votes
1 answer
EditButton() in SwiftUI inside a ScrollView / LazyVGrid
It seems like the EditButton() in SwiftUI (Xcode 12.5 beta 3) has various issues.
In my code, everything was working fine until I replaced the List with a ScrollView and added a LazyVGrid. Now, when a user taps on the EditButton, EditMode is not…

FPL
- 456
- 4
- 21
0
votes
1 answer
Dismiss a View in SwiftUI when parent is re-rendered
Using iOS14.4, Swift5.3.2, XCode12.2,
I try to dismiss a SwiftUI's GridView (see below code).
The dismiss function is done by the \.presentationMode property of the @Environment as explained here.
Everything works until the moment where I introduced…

iKK
- 6,394
- 10
- 58
- 131
0
votes
0 answers
SwiftUI LazyVGrid animating change of "page"
I’m trying to treat an entire LazyVGrid as pages, and animate when switching forward or back. A simple slide animation would be fine.
I currently have something along the lines of
LazyVGrid(
columns: [array of column info],
…

Hoopes
- 3,943
- 4
- 44
- 60
-1
votes
0 answers
SwiftUI, dynamic Grid
I am trying to build a dynamic grid.
This grid is supposed to hold a dynamic number of "items", which can be deleted and added by the user.
I want the grid to extend over the entire width of the devices screen. The height of the grid shall depend on…

Makani
- 33
- 1
- 2
-1
votes
1 answer
How do I create selection state for items in a SwiftUI LazyVGrid, so it behaves like a list selection
I am putting a grid view together in the details section of a navigation view. I would like to be able to to have a selection state on individual grid items as the user clicks them, similar to the way the List works. I don't want multiple…

Phil Bunker
- 141
- 1
- 8
-1
votes
1 answer
LazyVGrid where every item takes only the place it needs
I just wondered how you could make a LazyVGrid where every item takes only the place it needs, not less and not more.
I know about .flexible() but the problem is: My Items are different sized, that means I don't know how many of them will fit in a…

Boothosh81
- 387
- 1
- 5
- 24
-2
votes
1 answer
Sheet from Lazyvgrid.. again
I know this has been asked before, but I just can't figure out why it isn't working for me. I'm pretty new to coding, so any help would be appreciated.
Trying to have BookSheetView open as a sheet after selecting a cell in my lazyvgrid.
struct…

Benjec83
- 31
- 6