Lazy Loading
I'd be nice to have the content loading lazily - meaning only the views on screen (or views that are about to be on screen) will be rendered.
Tasks
- Is lazy loading possible using
Layoutprotocol? - If so, how can
MasonryStackadapt lazy loading? - Any other considerations?
Let me know if you want to take on this issue by commenting below.
I implemented a similar solution with help from here - https://stackoverflow.com/questions/66101176/how-could-i-use-a-swiftui-lazyvgrid-to-create-a-staggered-grid
I was on the lookout for such solution for very long time and it looks like the solution was super easy in the end.
@PankajGaikar The problem with this approach is, that it doesn't conform to the Layout protocol which is a nice-to-have when you want to have different layouts in specific contexts or want to allow the user to switch between different layouts.
As workaround I've tried using the following code and views are being rendered lazily. But it would be better if library offers this feature.
MasonryVStack {
ForEach(array) { item in
LazyVStack {
ItemView(item)
}
}
}