Search results for

SwiftUI List performance

50,605 results found

Post

Replies

Boosts

Views

Activity

Reply to SwiftUI List performane
I have the exact same problem. It seems that SwiftUI is not very smart, it compares the entire list, not only the visible rows. And what is worst, it processes each row, so if you have complex rows showing more data from relationships, is even slower. I decided NOT doing long list with SwiftUI for now, but now I have another problems because my app uses a synchronizer for updating the coredata and when something is modified in the background, does not trigger the UI update, not even using @FetchRequest SwiftUI is still BETA IMHO
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’19
Reply to How to get and set SwiftUI List scroll position?
Update for iOS 14 and macOS Big Sur (i.e this year’s update of SwiftUI). If using a ScrollView instead of list, there is new API for setting the scroll position: https://developer.apple.com/documentation/swiftui/scrollviewproxy/scrollto(_:anchor:) I discussed this with Apple engineers during a SwiftUI lab. No clean API to get scroll position to implement something like infinite load. But at least we can set it cleanly now. For many cases of displaying content, using ScrollView + LazyVStack is better than using a List, and then we can also use this new API.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’20
Not Allowing Row Selection in List
In UIKit, it's just the matter of setting table view's allowsSelection to false if you don't want to allow selection. If each row has a button, it can still be clicked on. Can we do that in SwiftUI? I have the following simple SwiftUI project. import SwiftUI struct ContentView: View { @State private var fruits = [Apple, Banana, Mango, Watermelon, Pineapple, Strawberry, Orange] @State private var isEditable = true var body: some View { List { ForEach(fruits, id: .self) { fruit in HStack { Text(fruit) .onDrag { return NSItemProvider() } Spacer() Button { print(Hello) } label: { Text(Tap me) } } } .onMove(perform: move) } .onTapGesture(perform: { return }) .listStyle(.plain) } func move(from source: IndexSet, to destination: Int) { fruits.move(fromOffsets: source, toOffset: destination) withAnimation { isEditable = false } } } The tap gesture prevents row interaction. So I won't even be able to tap the button. How can I disable row selection while allowing in
1
0
2.3k
Aug ’22
Reply to Unable to set initial selection state of SwiftUI `List` in iOS 14
No solution here. As far as I can tell, when SwiftUI instantiates or updates a List, it sets the bound selection variable to nil, and I have not been able to find any way to change this. For example, setting the selection variable in an .onAppear modifier on the list doesn't work, because SwiftUI apparently clears the selection after the onAppear action executes. I tried playing with the selection variable’s didSet property observer, but SwiftUI apparently clears the variable in a way that doesn’t trigger didSet. I’ve pretty much reached a dead end, too.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
How to track the performance of Win-Back Offers?
I have been experimenting with the new Win-Back Offers in the App Store, however I have been unable to find any way to track the performance of these campaigns in App Store Connect. How can I track the performance of Win-Back Offer campaigns? Specifically i'm looking for a way to see impressions, clicks, and conversions - as well as any information available about the source (in-app, app store search, app store listing, etc)
0
0
257
Feb ’25
Reply to SwiftUI Table View is Crashing
I can confirm that I see the same thing on large List views on MacOS. Doesn't happen on iOS. The suggestion from Claude31 doesn't help the programmer in this case, since the bug is happening in SwiftUI and the underlying TableView code is being done by the SwiftUI framework.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’20
Reply to GeometryReader crash
I was able to create a reliable reproducer of the precondition failure. The magic combination seems to be a SwiftUI List in a Tab, where each element in the List utilizes a GeometryReader to read the GeometryProxy's frame. Also, the List rows are populated in onAppear. Simply switching to a tab containing a List configured as described causes the precondition failure.I've submitted FB7733658.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’20
Reply to RealityView update closure
Hello, in your solution, you are removing the graph and creating it again. I guess you only wanted to perform incremental updates just as a swiftUI view. Is this approach performant enough? (imagine a graph of 1000 entities that you remove and create at each update). Has anybody found a solution to perform incremental updates of a reality kit graph with a proper MVVM such as a Swift UI view? Based on another thread, what I have in mind is to perform observation of specific properties in a non swift ui view to trigger the updates. Hope it will come with WWDC 2024 :-)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
What is a performant way to change view offset as user scrolls?
I added a background view to my SwiftUI List, and would like to move it up as user scrolls (similar to the effect of that of the Health app). I can't add it onto the background of a List row, because List unconditionally clips content to a row, and I would like the view to extend past a insetted row's bounds (scrollClipDisabled does not work on List). So I added the view as the background view of the entire List. Currently, I am achieving this by monitoring contentOffset using the new onScrollGeometryChange(for:of:action:) modifier, updating a state variable that controls the offset of the background view. The code looks something like this: struct ContentView: View { @State private var backgroundOffset: CGFloat = 0 var body: some View { List { ... } .background { backgroundView .offset(y: backgroundOffset) } .onScrollGeometryChange(for: ScrollGeometry.self) { geometry in geometry } action: { oldValue, newValue in let contentOffsetY = newValue.con
3
0
963
Aug ’24
textfield refreshes the list
Hey guys, I have multiple textfields in a List. Every time I change one letter, the list immediately refreshes and causes the textfield keyboard to dismiss. I tried to use onCommit (on clicking Done on the keyboard), but if the user edits multiple textfields, only the last textfield would listen to the onCommit changes. Is this a swiftUI List bug? Thank you in advance
2
0
395
Apr ’22