Is List in SwiftUI also lazy loading content in iOS 14 like LazyVStack?

There is LazyVStack to work with a large amount of content inside a ScrollView and ensure good scrolling performance.

I like to work with List in my apps as it provides some more functionality than just a ScrollView with a stack of content inside.

Does List in SwiftUI now also use lazy loading of content elements in iOS 14?

If it does not support this by default is there any way to make it work with lazy loaded content?

I tried this code but it caused rendering issues:

Code Block swift
List {
LazyVStack {
Text("1")
// [...] hundreds of Text views for testing
}
}


Accepted Reply

I just discovered this one sentence in wwdc20-10031: "List contents are always loaded lazily".

Replies

I just discovered this one sentence in wwdc20-10031: "List contents are always loaded lazily".
Under the hood there is a UIKit TableView for a SwiftUI List, so it makes sense given that UITableViewCells are reused.

Lists seems to be lazy on iOS but not on macOS 12. It would be great to see lazy lists in macOS 13.

There is also a discussion about List performance on macOS on StackOverflow.