Let's consider a list of 100 posts. According to Apple, if I layout them inside a LazyVStack
:
the stack view doesn’t create items until it needs to render them onscreen.
What if I embed that LazyVStack
inside a VStack
? Does it still load the views "as needed"?
Running the above code, as we scroll we can see more
MyView
s are init'd (by viewing the print statements in the console), so it seems like aLazyVStack
in aVStack
does indeed create it's content lazily. We can see the same is true when removing theVStack
as well.