Questions tagged [lazyvgrid]

131 questions
0
votes
0 answers

SwiftUI bug: LazyVGrid in ScrollView does not always show/layout label of Button or NavigationLink when scrolling slowly

This is probably a SwiftUI bug, but I hope someone has a solution for the following problem. I have tried numerous work-arounds but did not find a solution myself unfortunately. I have tested with iOS 15, iOS 16, 16.1, iOS 16.5.1 on devices and on…
rdor
  • 101
  • 1
  • 4
0
votes
0 answers

LazyVGrid is not behaving lazily

The following code creates a list of 20 view models(vm) and view displays only 6 at a time, but all 20 are created immediately. Any reason for that? struct ContentView: View { @StateObject var vm = RMCharacterListResponseDownloadViewModel() …
Craig
  • 11
  • 1
0
votes
0 answers

Preventing SwiftUI ScrollView View Refresh When Appending New Items in LazyVGrid

Issue: SwiftUI scrollview with LazyVgrid refresh entire view on appending new items I am trying to implement a gallery view where i fetch images remotely, the api i use support pagination and hence i fetch only n number of images at a time, i want…
Natto
  • 213
  • 1
  • 4
  • 17
0
votes
1 answer

SwiftUI LazyVGrid with scroll view issue

The text "Bottom Text" is intended to occupy some space at the bottom. However, when using a LazyVGrid with a scroll view, the content ends up being rendered behind the bottom text, and the scrollable area appears to stretch beyond the screen. How…
Zim
  • 674
  • 7
  • 15
0
votes
1 answer

How to animate a full LazyVGrid on change of data

I am trying to animate the below LazyVgrid from right to left on change of the content when a user taps on one of the 4 buttons but I can't get to make it work. LazyVGrid LazyVGrid(columns: columns, spacing: 20) { …
axeeeeelt
  • 3
  • 2
0
votes
1 answer

How to update UILabel inside ForEach loop in SwiftUI and avoid 'No exact matches in reference to static method 'buildExpression'' error?

I'm trying to create a list of circles in SwiftUI that display different strings of text. To achieve this, I'm using a ForEach loop that creates a UILabel for each string and sets its text, font size, and number of lines accordingly. However, I keep…
eugene_prg
  • 948
  • 2
  • 12
  • 25
0
votes
0 answers

using LazyVGrid in SwiftUI TVOS app will lose focus when scrolling through the list

For learning purposes I am trying to make a TVOS 16.1 app. I load data in via an API. The problem that I cannot solve is as follows; When images are loaded in and presented in a LazyVGrid with 4 columns, and I am at the bottom of the list - when I…
0
votes
1 answer

Jetpack compose how to skip one item in a LazyVerticalGrid / java.lang.IllegalStateException: Check failed

i'am starting to work with jetpack compose. i'am creating a grid to display some Box with some text. the problem is that i get my data from my api and some might be null. So i would like to skip this item in my grid but it doesn't work. Here is my…
0
votes
1 answer

Strange results with data input and nested Foreach loops

I use Xcode 14.2, macOS Monterey 12.6.2 and Minimum Deployments 15.5. I want to display 4 TextFields in a 2x2 grid for integer input. The data is stored in an extern struct Model as an ObservableObject. The environment variable is injected in the…
Heinz M.
  • 668
  • 3
  • 8
0
votes
0 answers

Drag and Drop items in a lazyvgrid/lazyhgrid

pretty new here, and to coding in general. I actually want to comment on another post, but I don't have enough reputation :( I'm trying to drag and drop rearrange a lazyVgrid. I tested this, and indeed it works for a list, but it doesn't work for a…
Benjec83
  • 31
  • 6
0
votes
1 answer

How can I change button status in SwiftUI?

I am trying to change the color programmatically of some buttons in SwiftUI. The buttons are stored in a LazyVGrid. Each button is built via another view (ButtonCell). I'm using a @State in the ButtonCell view to check the button state. If I click…
JoLight
  • 5
  • 4
0
votes
0 answers

Creating a LazyVGrid that "snakes" (each row has a rotation effect applied to it)

I am trying to create a grid within SwiftUI where the index "snakes" from left-to-right, right-to-left, and left-to-right (ad infinitum). The approach that I've been trying to implement is essentially applying rotationEffect to each row, but the…
0
votes
1 answer

How to tap on a grid item in a LazyVGrid and segue to another view (Essentially like a collection view)

I have my code set as follows: var body: some View { NavigationStack { VStack { // Contacts Scroll View ScrollView { LazyVGrid(columns: threeColumnGrid, spacing: 20) { …
0
votes
0 answers

How to build square cells in a SwiftUI LazyVGrid containing dynamic type

I'm trying to build a LazyVGrid, that contains square cells that dynamically size with the text inside them, something like this: struct BandView: View { let bands: [Band] var body: some View { LazyVGrid(columns:…
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
0
votes
2 answers

How can the navigation bar title be set as the item's name upon tapping on a specific item?

I'm creating a dinner menu with various food item's that can be tapped. Each item is wrapped in a NavigationLink that leads to it's detail page. How can the item's name be placed as the navigation bar title for each item? Here's the entire…
1 2 3
8 9