1,364 questions
-2
votes
0
answers
28
views
How to completely remove the horizontal “ghost lines” inside List with Section and custom rows?
I’m working on a screen that uses a single SwiftUI List composed of:
a top block (statistics, month picker, year selector, total, Entrata/Uscita picker).
a list of transactions grouped by day, each ...
1
vote
1
answer
106
views
List view bottom edges not being clipped ios 26
before updating to iOS 26 my list was looking fine but now it has abnormal paddings and because I am using fixed height, I had to increase the height from 40 to 60 to fit the text.
There are currently ...
1
vote
1
answer
97
views
Collapsible header hides after pull-down gesture
I’m trying to implement a collapsible header in SwiftUI that collapses when the user scrolls down and expands when the user scrolls up.
I followed this Medium post: Collapsible Header in SwiftUI
The ...
2
votes
1
answer
187
views
How to programmatically trigger SwiftUI's .refreshable loading animation?
I have a SwiftUI List with .refreshable modifier that works perfectly when users manually pull to refresh.
However, I need to programmatically trigger the same refresh animation when certain ...
0
votes
0
answers
63
views
Choppy animation for SwiftUI DisclosureGroup in List
Without List
List
Just throwing this question out if there's a way to improve the animation of the DisclosureGroup in a list. The way the row just abruptly collapses in the list and the corner radius ...
-6
votes
1
answer
96
views
How can I decrease the distance between a VStack and a Section in a List View?
List {
VStack(alignment: .leading, spacing: 8) {
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 0)
.listRowBackground(Color.clear)
// 2. History ...
1
vote
1
answer
118
views
How to show trigger refreshable spinner from ViewModel?
I want to be consistent with showing the spinner when user loads a list view, and show the same List view spinner when user pulls to refresh or if the refresh is triggered from ViewModel. I understand ...
0
votes
1
answer
71
views
How to enable drag to scroll in SwiftUI List padding area
I notice in the iOS settings menu, all of their lists can be scrolled by dragging in the margins to the sides of the list items. This is only really noticeable on iPads. I'm trying to replicate this ...
0
votes
0
answers
50
views
What is the reason that there is a top padding on UIViewRepresentable in a SwiftUI container
When nesting a UIViewRepresentable inside a SwiftUI List, applying a .scaleEffect between two .frame(...) modifiers causes the view to appear with unexpected top padding in the list row.
import ...
0
votes
0
answers
44
views
List animations broken in macOS Sequoia but work in Sonoma (FetchRequest, Picker filters)
In macOS Sonoma, my SwiftUI code performs smooth, expected animations when List contents change — both when using @FetchRequest with a changing predicate and when filtering manually via Picker ...
0
votes
1
answer
382
views
How to use custom designs for a swipeAction in a list row in SwiftUI
I have a SwipeActions on my list so when the user swipes on a list row, it give's them the option to delete the current list cell. I have a button inside the SwipeActions that handles the deletion. ...
1
vote
1
answer
86
views
Is it possible to check if swipeActions() was called inside List or inside other container?
I need to use native swipeActions() if it was called inside List, and custom solution if it was called in ScrollView.
Currently closure inside swipeActions is calling in both cases, if swipeActions() ...
0
votes
2
answers
119
views
swipeActions change content size on second swipe
I made some UIImage to keep font and icon sizes according to my design. Problem: when user swipe cell - it shows content properly, but when user start closing swipe and very fast, before animation of ...
0
votes
1
answer
67
views
Is it possible to have a list style input TextField stay frozen at the top while a list of data below it is able to scroll?
The following is a simplified version of a screen that is in my app:
From the following code:
import SwiftUI
struct HomeView: View
{
@State private var textFieldUserInput: String = ""
...
0
votes
1
answer
89
views
Permanently Make List's Section Headers Transparent
I need transparent section headers in a SwiftUI List that stay transparent when they become sticky during scrolling.
Using SwiftUI Introspect, I can make headers transparent initially, but UIKit re-...
2
votes
3
answers
198
views
How to set gradient background on SwiftUI's List Section
I'm trying to set different gradient to the each section for swiftui list section but its not working and showing some weird gradient on individual cell!
I'm expecting single background for whole ...
1
vote
1
answer
63
views
SwiftUI Lists Section - Add a header and the toolbar items repeat
I am displaying a list of names in a “list". When I encapculate this in a section it works. BUT when I add the header the Toolbar items get duplicated. If I REM it out it behaves as expected, e.g....
0
votes
1
answer
33
views
One ForEach eats up another ForEach loop in SwiftUI LazyVGrid?
Here's the simplest code I tried that acts wrong:
the grid has 10 red rectangles and 1 black rectangles
the grid has 6 red rectangles and 5 black rectangles
LazyVGrid(columns: Array(repeating: .init(....
0
votes
1
answer
132
views
SwiftUI List causes memory leak even after deleting items
I’m building a SwiftUI app that displays a list of Streamer objects. Each Streamer is an @Observable class, and I keep them in a modelManager singleton.
@Observable
class Streamer: Identifiable {
...
0
votes
0
answers
65
views
SwiftUI List onInsert not called on iOS (works on macOS)
I am working with a simple SwiftUI List and I want to enable functionality that allows files and images to be dropped onto the List from outside the app. There is an onInsert modifier with List that ...
0
votes
0
answers
106
views
Change the selected item highlighted background color inside the ListView
How do I change the neon selected background color to something like red?
I tried .tint and .listRowBackground but they aren't working.
The only working solution is to change the accent color in ...
0
votes
0
answers
91
views
Maintaining a stable scroll position when inserting items above in a ScrollView
As the title says, I am not sure how to properly build an inverted ScrollView where I can safely insert items above my data ("prepend") without everything jumping around.
My current code is ...
1
vote
0
answers
16
views
SwiftUI List scrolls down unexpectedly when switching keyboard from default to decimalPad
In a SwiftUI List, when switching from a default keyboard to decimalPad keyboard, the List scrolls down unnecessarily and the focused textfield is hidden by keyboard.
struct ListTextField: View {
@...
0
votes
1
answer
99
views
SwiftUI MacOS - scrollable List
I might be missing something obvious here, but I can't find how to get around it. I want to have List() with limited height, that allows me to scroll inside it. This is an example code:
struct ...
0
votes
1
answer
61
views
List, form updating and cursor issue
I`ve adapt official Apple tutorial app for my needs.
There is a ContentListView that displays a list of recipes on one side and a form to edit the selected recipe on the other. The form includes a ...
0
votes
0
answers
50
views
SwiftUI Button in List works only with press+slide rather than tap
When checking a checkbox Button in List:
Click/tap events don't trigger the expected response
The associated action button only activates with a press+slide
What could be causing this interaction ...
0
votes
1
answer
38
views
Why does using .listRowBackground in only one instance gives me a compiler error, while other instances do not?
Trying to add a clear background to all cells, so I applied listRowBackground(Color.clear) to each List. All worked, except the second instance (commented out in the code below).
Uncommenting it out ...
0
votes
1
answer
45
views
Can I make a SwiftUI's List background clear, so only the cells show?
For a List in SwiftUI, I would like the list background to be clear so that only the cells appear, with the foreground and background I decide. When an iOS device is in light mode it's ok. But if it's ...
0
votes
2
answers
94
views
SwiftUI Menu in List only the Text is tappable
Problem: Adding Menu inside List but only the text(black area) is tappable not the entire row. The source code and resulting image are shown below.
struct testMenuInList: View {
var body: some ...
0
votes
1
answer
119
views
Animating items in a SwiftUI list only at first appearance
I have a simple SwiftData app. Whenever ImageLibraryView appeared, there were microhangs because images inside each ThumbnailView were being loaded synchronously.
So I solved that by loading the ...
1
vote
1
answer
120
views
SwiftUI: Show popover at mouse click location
I am working with a SwiftUI List on macOS, and I have a popover view that I need to show from each row. I have an implementation that works but it shows the popover from one fixed point on the row. I ...
0
votes
0
answers
53
views
List throwing Invalid sample AnimatablePair With Drag Gesture [duplicate]
With the below code, if I try to scroll the list very fast of drag it up or down multiple times. I see the following error.
Invalid sample AnimatablePair<AnimatablePair<CGFloat, CGFloat>, ...
1
vote
1
answer
84
views
List cannot scroll vertically If hovered a List subview that needs to support horizontal scrolling
I have a List that contains some views, some of which need horizontal scrolling. It is important to note that none of the views require vertical scrolling. When my mouse hovers over the views that do ...
0
votes
2
answers
248
views
SwiftUI: TextField not getting focus changes inside Button
I have a SwiftUI List (on macOS) where I want to display a few TextFields in each row, and observe how the focus changes as an individual text field is selected or unselected. This seems to work fine ...
1
vote
1
answer
802
views
Chatbot UI Like ChatGPT in iOS SwiftUI
I am working on a chatbot app and want to implement a chat interface similar to ChatGPT's UI. When a user sends a message:
The previous messages should move out of view at the top.
The user's latest ...
1
vote
1
answer
86
views
How do I validate and modify a proposed selection in a list?
Context
In a Mac (nb: NOT iOS) app, I have a complex OutlineView that is powered by SwiftUI's List and various embedded DisclosureGroups. Here's what it looks like:
Question
I need control over which ...
0
votes
1
answer
235
views
SwiftUI .onMove modifier and .moveDisabled
I have a list in my view, which contains plenty of fruits.
I want to move the fruit inside the list, except I don't want to move Banana.
Here's my code:
struct FruitsView: View {
@State private ...
0
votes
0
answers
41
views
Passing 'focus' between sibling views
I am trying to construct a view where they are multiple buttons, and selecting each button can show a different List view. I want to be able to select the controls with just the keyboard, so if the '...
1
vote
1
answer
59
views
List view is not updating when iCloud is activated
The following code is working perfectly fine when iCloud is deactivated.
A meeting object is saved to the DB and the list on ContentView is updated properly.
But when I activate iCloud the list is not ...
0
votes
1
answer
90
views
Popover is not opening from a list of items in SwiftUI [duplicate]
I have a list of items and when user click on it, I need to show some content in .popover().
Model:
struct Item: Identifiable {
var id: String {
UUID().uuidString
}
var name: String?
var ...
1
vote
0
answers
121
views
toolbar(.hidden) not working when navigate while searching is active
Well Im just creating a personal project and then I face this bug. My navigation looks like this, if you compile the code and then try to navigate while you are not searching the .toolbar(.hidden) is ...
1
vote
1
answer
36
views
Is there a better way to delay a variable assignment to delay a sheet presentation
I want to delay the sheet presentation via shouldPresentEditExpense. The reason is to show a selection animation of a cell.
The selectable effect takes place via ViewModifier.
overlay { isSelectedItem ...
0
votes
1
answer
54
views
Swiftui List @State could not select Struc View
This particular SwiftUI List, made up of array, I can not seem to select it. Even though I tried with Set(). or @Binding. everything online resource has to offer.
Wrong type? or something might have ...
1
vote
1
answer
65
views
Why do I get inconsistent animations in this list view?
I'm digging into the weeds of SwiftUI and learning about view Identity for the first time. When playing around with some code and following along with WWDC talks I'm hitting some confusing animations.
...
0
votes
1
answer
78
views
SwiftUI List Rendering More Cells than Necessary When Using a Custom Cell View
I am experimenting with SwiftUI and noticed unexpected behavior when using a custom view inside a List. Here’s the simplified code:
import SwiftUI
struct ContentView: View {
var body: some View {
...
-1
votes
1
answer
126
views
(SwiftUI) Segmented Picker in a pinned SectionHeader does not Update ScrollView ContentHeight as expected
Within a Scrollview, i am trying to have a pinned SectionHeader with a simple segmented PickerView, that can switch to two different item Stacks. One very long and one very short. This works fine, as ...
2
votes
2
answers
53
views
Using a single member of an array in both a bound and unbound way in ForEach in SwiftUI without using indices
Apologies because I'm new to SwiftUI -
I have a class (Meal) that contains an array of objects of another class (Food). What I'm trying to achieve here is to be able to add foods and have that update ...
0
votes
0
answers
44
views
Append item in list with slide animation
I have one view named CongratulationOverlay, and in bottom there is one horizontal list. Now I want that overlay view to slide in to the horizontal list as I am appending that into list. and ...
1
vote
1
answer
112
views
SwiftUI List/ScrollView x MapKit - Map adds gradient/material toolbar (navigation bar) and overrides its design
I'm working on iOS 17+ app in SwiftUI, which uses MapKit.
MapKit's Map view adds a gradient/material view on Toolbar, which is presented on second and every next navigation.
I would like to get the ...
2
votes
1
answer
203
views
Why does my list row separator disappear?
This is in Xcode 16.2 with the iOS 18 SDK, build target iOS 17.
I have some very simple code:
List {
HStack {
TextField("Some field", text: .constant("Hello"))
...