I primarily do iOS and iPadOS, but it’s far easier to bridge the gap between all the platforms than the experience I had in the past with UIKit/AppKit. My last MacOS app sadly does not do infinite scrolling.
Off the top of my head, I’d consider the approach. Is it a ScrollView? A LazyVStack? What do your view redraws look like?
Anyone working with Swift Strings back in Swift 1+2 was in for some shockingly bad performance. We adopt, we adapt, and the framework matures.
LazyVStack and ScrollView don't scale (no cell reuse / no unloading). The only option is List which has different behaviors and performance characteristics on macOS including issues with eager rendering
To be fair a LazyVStack handles cell reuse and unloading automatically which is why offscreen content that was previously viewed further back on the list will only maintain the root level state (children in the view hierarchy may and will lose state in order to save memory and energy). How that data is loaded and how you key off Identifiable is also important.
Apple’s own documentation discusses this in detail and for large data sets recommends the Lazy approach. If you’re using List you’re in for some issues.
I’m on a phone which means digging through Apple docs or WWDC-ascii isn’t fun. But for my recent Insta-like infinite feed on iOS this was very helpful:
Also... Funny that I'm getting downvoted for correctly pointing out that LazyVStack doesn't reuse or unload views. It's so obvious that they should, that no one can believe they don't.
Off the top of my head, I’d consider the approach. Is it a ScrollView? A LazyVStack? What do your view redraws look like?
Anyone working with Swift Strings back in Swift 1+2 was in for some shockingly bad performance. We adopt, we adapt, and the framework matures.