Questions tagged [lazyvgrid]
39 questions
0
votes
2 answers
How to allow ForEach layout item to show duplicate item from array in SwiftUI?
I am working with on multiple choose answer quiz app.
var itemsTemp = ["ant","bat", "bear", "bee", "bird", "butterfly", "camel", "cat", "cheetah","chick", "chicken"]
Updated
Here is example of my quiz app.
let answerIndex = Int.random(in: 0...3)…
Nazmul Hasan
- 8,494
- 5
- 44
- 64
0
votes
0 answers
How can you set the background color of a column in LazyVGrid?
I'm using LazyVGrid to display a calendar month and would like to have the Sat and Sun -columns have a different background color.
LazyVGrid(columns: columns, spacing: 34) {
ForEach(daysForMonthView, id: \.self) { day in
…
Melodius
- 1,697
- 1
- 15
- 29
0
votes
0 answers
Order LazyVGrid Elements vertically rather than horizontally - SwiftUI
I have a LazyVStack which will grow vertically depending on how many elements are in it. However when it is generated, the elements go left to right, then down to the next row etc. I want it to order the elements vertically and then when it has…
benpomeroy9
- 175
- 1
- 14
0
votes
0 answers
LazyVGrid Items Overlap
I need some help with understanding why there is overlap in landscape with my Swift LazyVGrid. This is mentioned as an issue in this article: https://swiftui-lab.com/impossible-grids/ but I haven't found a great work around in my code.
Here is the…
jlarks32
- 751
- 5
- 17
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,077
- 4
- 31
- 50
0
votes
0 answers
NavigationLink in ZStack not clickable in test but in emulator
I have a NavigationView with a ZStack used to display a background image. And a ScrollView with LazyVGrid is on top of the background image to show a large amount of buttons all navigating to a slightly different ChildView:
struct ContentView: View…
L3n95
- 1,240
- 2
- 18
- 40
0
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
- 175
- 1
- 14
0
votes
0 answers
Inserting Views in LazyVGrid with random positions & sizes SwiftUI
I want to create similar grid like below with random positioning relative to the green grid positions and random sizes based on the colored boxes in SwiftUI
I tried the LazyVGrid with array of Views, problem is when initialize GridItems it has to…
Mohammed Zaki
- 111
- 1
- 10
0
votes
1 answer
LazyVGrid cell subviews keep disappearing for particular text inside cell
Scenario
I am trying to create a 3 columned LazyVGrid which displays items having an icon and a text via a LazyVGrid.
Code
struct CategoryPickerCellPresentationModel: Identifiable {
let id = UUID()
let name: String
let image: Image
…
G.Abhisek
- 766
- 7
- 34