top | item 43030634

(no title)

sandoze | 1 year ago

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.

discuss

order

wahnfrieden|1 year ago

Where do you see that it does cell reuse? It does not... Their docs only talk about lazy loading, not reuse or unloading, eg: https://developer.apple.com/documentation/swiftui/creating-p...

This is also why LazyVGrid/LazyHGrid are unusable as replacements for UICollectionView

Yes you can replace SwiftUI with UIKit + AppKit - replace the navigation, the text rendering, the text editing, the collection views, etc.

edit: Your link is all about how to use List

kridsdale1|1 year ago

Well the good news is you can keep using UICollectionView or MyFancyReuseView anywhere in the stack or tree of SwiftUI.