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

Adding a bunch of features and refactoring the code to make it more reusable #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

plivesey
Copy link

@plivesey plivesey commented Nov 20, 2019

  1. Refactors logic into FastCollection which now takes an arbitrary model and view
  2. Added public/private to things in a reasonable way
  3. Adding the ability to have variable row heights
  4. Making row height a parameter you can set
  5. Removing a VStack which was at the base of ContentView that didn't do anything
  6. Added a buffer parameter which allows you to load more views above and below the content window and means you're less likely to see white space when scrolling quickly

New commit:
This makes visibleRows a calculated property
This is necessary because otherwise it's only updated when you scroll
But you actually want to recalculate this every time body is called because the data in the view may have changed (due to insertion, deletion or completely new data)
Performance wise, I wasn't able to find any significant difference. Before and after this change, visible rows is calculated approximately the same number of times.
Also, I deleted the translatingY function as it wasn't used

Fixes #3

Another commit:
FIxes a bug where visibleBounds wasn't updated correctly
Makes a couple of performance improvements

…e reusable

1. Refactors logic into FastCollection which now takes an arbitrary model and view
2. Added public/private to things in a reasonable way
3. Adding the ability to have variable row heights
4. Making row height a parameter you can set
5. Removing a VStack which was at the base of ContentView that didn't do anything
6. Added a buffer parameter which allows you to load more views above and below the content window and means you're less likely to see white space when scrolling quickly
This is necessary because otherwise it's only updated when you scroll
But you actually want to recalculate this every time body is called because the data in the view may have changed (due to insertion, deletion or completely new data)
Performance wise, I wasn't able to find any significant difference. Before and after this change, visible rows is calculated approximately the same number of times.
Also, I deleted the translatingY function as it wasn't used
Calculated the visibleRows once per layout
Making sure that visibleRowBounds is calculated every layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The view doesn't update when data changes
1 participant