Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy Loading #1

Open
lukepistrol opened this issue Aug 26, 2023 · 3 comments
Open

Lazy Loading #1

lukepistrol opened this issue Aug 26, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lukepistrol
Copy link
Owner

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 Layout protocol?
  • If so, how can MasonryStack adapt lazy loading?
  • Any other considerations?

Let me know if you want to take on this issue by commenting below.

@lukepistrol lukepistrol added enhancement New feature or request help wanted Extra attention is needed labels Aug 26, 2023
@PankajGaikar
Copy link

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.

@lukepistrol
Copy link
Owner Author

@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.

@ltns35
Copy link

ltns35 commented Jan 4, 2024

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)
        }
    }
}       

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants