Relative Content

Tag Archive for iosswiftswiftuiswiftui-list

How to scroll a dynamic list with other elements inside scroll view?

I have a complex app and a complex sheet view which has a lot going on inside it hence sharing a sample code. It’s basically divided into 2 portions where upper part has static elements which shouldn’t scroll and other part of the view has scrollable elements (buttons vertically stacked and a dynamic list). When keyboard is up, user should be able to scroll these scrollable elements to look at it.

SwiftUI List memory leak in a quite simple scenario

Short problem description: I wanted to explore how SwiftUI’s List manages cells allocation and deallocation when cells are visible/invisible. For this, I’ve created a simple demo project which has: Payload – a data model, contains id: Int and image: Image. PayloadViewModel – manages [Payload], when instantiated just creates 300 values of Payload, where id goes […]

SwiftUI – How to distinguish tap gestures when there is a button inside a bigger area that has a tap gesture?

I have a List and in each row I put a button at the left end and a text label on the right next to it. I want this button to have an action and the entire row to also have a tap gesture. So how can I properly distinguish between the gestures so that when the use taps the button it does the action of the button, and when the user tap anywhere else in the row, it does the tap gesture of the row?

SwiftUI NavigationSplitView title appearing as inline instead of large title unless scrolled

I discovered a really weird issue with the title on the sidebar on iPads. I’ve set the navigationBarTitleDisplayMode to .large, but on first load (right after I run the app on the simulator), the title is shown as inline but if I pull the list downwards (scrolling up), the title becomes large. It’s as if the list is scrolled up on first load. But the list is fully visible so it doesn’t really appear like it was scrolled. I hope my explanation makes sense.

Looping sections with grouped values from model

I am attempting to place drugs under sections correlating to their class but im getting multiple sections for each drug I add of the same class. Im not sure how much this process differs when using model macros.

SwiftUI – List swipe action gets stuck

I’m implementing a custom bottom sheet using SwiftUI (iOS 15). I’m having an issue where the list stops responding to gestures if I hide and reopen the list with the swipe button visible.