Giter Club home page Giter Club logo

Comments (5)

sindresorhus avatar sindresorhus commented on August 26, 2024

It would also be useful with a method that runs a callback when an element enters/exits the viewport, since .onAppear() triggers for all grid elements at load time and not when they enter the viewport. Maybe called .onVisibilityChange(isVisible:).

from swiftui-grid.

victormihaita avatar victormihaita commented on August 26, 2024

@ay42 I try to paginate my API calls using this logic and is impossible because I cannot know when the last item in my dataSource is displayed. I think this is an important fix as well as #81
Do you have an ETA for this?

from swiftui-grid.

ay42 avatar ay42 commented on August 26, 2024

@victormihaita most likely this feature will not be implemented. Just like HStack and VStack, Grid is a lower level layout element. I imagine this can be done with the ViewModifier on the presented views directly but not as a part of this project.

from swiftui-grid.

ay42 avatar ay42 commented on August 26, 2024

@victormihaita I'm looking for a way to fix #81, do you know how to do it?

from swiftui-grid.

victormihaita avatar victormihaita commented on August 26, 2024

In this code, when calling onAppear, I expect that it should be called only for the elements visible on the screen, but instead is called for all the elements in the grid. is that correct? This causes also the issue #81 in my case.

Grid(viewModel.dataSource, id: \.id) {
    CardView($0).onAppear {
        //Do something
    }
}

from swiftui-grid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.