Does the List in SwiftUI reuse cells similar to UITableView?

吃可爱长大的小学妹 提交于 2020-01-11 07:04:51

问题


I am working on creating a dynamic list using SwiftUI. Does the SwiftUI List container reuse the cells similar to UITableView?


回答1:


Yes, List is reusing its ListCoreCellHosts exactly like the way UITableView reuses its UITableViewCells.

Reference:

Investigating memory usage with Xcode shows that, when the number of the items is more than List could present at once, it just shows as much as it can and reuses them when they become occluded from the top or bottom of the list.

By tracing a single cell memory address, you can see it is reused over and over. Another exciting tidbit is that ListCoreCellHost uses a hosting view that may refer to UIKit internally. (Not known well because it lacks documentation)



来源:https://stackoverflow.com/questions/56655421/does-the-list-in-swiftui-reuse-cells-similar-to-uitableview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!