pavankataria / SwiftDataTables

A Swift Data Table package, display grid-like data sets in a nicely formatted table for iOS. Subclassing UICollectionView that allows ordering, and searching with extensible options.
MIT License
448 stars 69 forks source link

Anyway to allow for infinite scrolling? #29

Open rmehta33 opened 5 years ago

rmehta33 commented 5 years ago

Hello,

Is there a way to do infinite scrolling? In UITableView it's relatively simple using scrollViewDidScroll, but I can't find something similar for this library.

Please help!

pavankataria commented 5 years ago

How are you achieving this with that delegate method with UITableView?

I'm presuming the implementation here, if you change the y offset position to go back to the top, but wouldn't the velocity suddenly change during a scroll and it coming to a half after the offset? aka it does not continue scrolling after changing the offset to give the effect of infinite scrolling

rmehta33 commented 5 years ago

So first I check whether I need to generate more data (using y offset), and then if I do, add the new data, reload the table, and scroll to the new last element using scrollToRow with the ".none" option. Not sure how it works behind the scenes, but there are plenty of articles online that go more in depth.

vahidnety commented 4 years ago

Any update for this?

vahidnety commented 4 years ago

So first I check whether I need to generate more data (using y offset), and then if I do, add the new data, reload the table, and scroll to the new last element using scrollToRow with the ".none" option. Not sure how it works behind the scenes, but there are plenty of articles online that go more in depth.

Have you found solution for this case?

pavankataria commented 4 years ago

In order for this to be achievable we must have first class support to add elements and reload efficiently without redrawing everything. This is one reason why this hasn't been explored further.

I'm currently focused on self sizing cells to to support a couple of features. I believe if this prototype proves successful the ability to add infinite scrolling will come for free.

I'll post on this issue directly about the results of my prototype. It will take a while to get this working. So far I've been able to achieve self sizing if the text gets larger, but there's still a lot of work to be done in order for the remaining cells to also have the same height as the tallest cell in the row. Screenshot 2020-06-26 at 13 59 54

Stay tuned.