fatbobman / blogComments

1 stars 0 forks source link

List 还是 LazyVStack:SwiftUI 中的惰性容器选择 #242

Open fatbobman opened 2 months ago

fatbobman commented 2 months ago

List 还是 LazyVStack:SwiftUI 中的惰性容器选择

在 SwiftUI 的世界里,ListLazyVStack 作为两大核心惰性容器,为开发者展示大量数据提供了强大的支持。然而,它们在某些场景下表现相似,常常让开发者在选择时感到困惑。本文旨在剖析这两个组件的特点、优势,以帮助你更好地作出选择。

List or LazyVStack: Choosing the Right Lazy Container in SwiftUI

In the world of SwiftUI, List and LazyVStack, as two core lazy containers, offer robust support for developers to display large amounts of data. However, their similar performance in certain scenarios often causes confusion among developers when making a choice. This article aims to analyze the characteristics and advantages of these two components to help you make a better decision.

sebnoumea commented 1 month ago

Much needed and appreciated. Thanks Fatbobman !

futuretap commented 1 month ago

Thanks for the helpful writeup. I'm missing one important piece: List has cell reuse, so it significantly reduces memory footprint when scrolling all the way to the bottom, especially when images are displayed.