Questions tagged [lazyvgrid]
The lazyvgrid tag has no usage guidance.
lazyvgrid
163
questions
-1
votes
0
answers
22
views
UI Freeze in SwiftUI Home View with Conditional Icon Display in LazyVGrid
I created a simple Home view that uses a LazyVGrid to display all my playlists. The UI freezes when I use an if-else statement or a switch to display different icons for the “delete mode,” “normal ...
0
votes
1
answer
107
views
LazyVGrid and scrollTo issue in SwiftUI
I have encountered an issue while implementing the scrollTo mechanism for a lengthy list of products displayed using LazyVGrid in SwiftUI.
Does anyone have a potential solution for this problem?
Below ...
0
votes
1
answer
58
views
SwiftUI LazyVGrid Inconsistent Item Widths Issue
I am new to SwiftUI and am learning it by making my application. I'm experiencing an issue with LazyVGrid in SwiftUI where the item widths are inconsistent. I'm trying to create a grid with a header ...
0
votes
2
answers
59
views
LazyVGrid is not redrawn on .id() change
I'm trying to update LazyVGrid item properties when tapped and it worked on plain Ints but stopped working when numbers are wrapped in collection.
code that doesn't work:
import SwiftUI
struct Item :...
0
votes
1
answer
168
views
How can I use LazyVGrid to create flexible card widths in different rows?
I want to display three cards in a single row. However, the challenge is to make the first and last cards width larger than the other two cards within the same row. The expected output is as follows.
...
0
votes
0
answers
74
views
How to make adaptive GridItem to fill in whole width with small number of items
I need to show 2-3 items horizontally if screen width allows and vertically otherwise.
I thought adaptive GridItem would do the trick. It works well for portrait mode, however it doesn't fill up ...
0
votes
1
answer
71
views
Using Grid container for an array of objects
In my model, I create an array of objects:
let myObjects = [ theObject(name: "first", ...),
theObject(name: "second", ...), etc.
I want to use the SwiftUI Grid ...
0
votes
1
answer
75
views
Why buttons on a LazyVGrid are not always pressed within a Scroll view in macOS
I created a LazyVGrid within a ScrollView (vertical & horizontal).
Although the layout works as I expect, when the user interacts with the window (eg: by changing its size) then button sometimes ...
1
vote
1
answer
237
views
ScrollView with multiple LazyVGrids jumping around when using .scrollPosition
I am using macOS.
I have multiple LazyVGrid in my ScrollView. I am using .scrollPosition() to track the scroll position. Without using this modifier, I don't have any issues, but if, the scrolling is ...
-1
votes
1
answer
29
views
How to Get the Size of the GrideItem View in LazyVGrid or Showing a Number Near the Corner of a View
I have a bunch of Buttons in LazyVGrid as shown in the picture below. I want to show a number near the top-left corner of a button. For a particular iOS device model, I can just offset the position ...
0
votes
2
answers
258
views
Memory allocation issue with SwiftUI’s LazyVGrid when displaying media files
I’m currently working on a SwiftUI application that displays media files in a grid with LazyVGrid on GalleryView where there will be 3 media files per row. The media files are loaded from the app's ...
0
votes
0
answers
22
views
Custom Lazy Grid list lags
I want to create custom implementation of LazyVerticalGrid. I've already done it but the scrolling list exhibits slight intermittent interruptions during movement. I can't see any additional ...
0
votes
1
answer
63
views
LazyVGrid produces different vertical spacing with different custom heights
I have LazyVGrid and inside I have a custom view that can changes it's height based on the image ratio the description etc ... the grid is sizing the view correctly but then the vertical spacing ...
0
votes
1
answer
38
views
Context menu responds to random locations
Here is the snippet of the code which creates this list:
ScrollView {
LazyVGrid(columns: columns, alignment: .leading, spacing: 8) {
ForEach(viewModel.previews) { item in
...
0
votes
2
answers
80
views
LazyVGrid ignores the leading padding of the first element
struct HomeView: View {
@ObservedObject var viewModel = CarViewModel()
let columns = Array(repeating: GridItem(.flexible(), spacing: 20, alignment: .center), count: 2)
var body: some View {
...