zenangst / Spots

:bamboo: Spots is a cross-platform view controller framework for building component-based UIs
Other
1.31k stars 72 forks source link

Improve/layout with paginated scrolling #821

Closed zenangst closed 6 years ago

zenangst commented 6 years ago

This PR aims to improve the user experience when scrolling paginated components on iOS. It also simplifies the implementation be removing the methods on Component that was related to scrolling and instead have that live on the ComponentFlowLayout. The Component now calls that method when it needs the initial offset for a Component.

The improvements to the scrolling are that the offset that the user has to scroll is much less than it was before this PR. It creates an offset by checking the initial content offset with the proposed new offset, that way it knows which way the user wanted to scroll plus how much they scrolled. Based on that outcome we can determine what the user wants with greater precision.

codecov[bot] commented 6 years ago

Codecov Report

Merging #821 into master will increase coverage by 8.72%. The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #821      +/-   ##
==========================================
+ Coverage   76.08%   84.81%   +8.72%     
==========================================
  Files         152      153       +1     
  Lines       10432    10555     +123     
==========================================
+ Hits         7937     8952    +1015     
+ Misses       2495     1603     -892
Flag Coverage Δ
#ios 82.85% <60%> (+25.01%) :arrow_up:
#osx 86.67% <ø> (ø) :arrow_up:
#tvos 74.05% <36.66%> (+0.22%) :arrow_up:
Impacted Files Coverage Δ
Sources/Shared/Classes/Delegate.swift 100% <ø> (ø) :arrow_up:
Sources/iOS/Extensions/Component+iOS+List.swift 94.73% <ø> (ø) :arrow_up:
...OS/Extensions/Delegate+iOS+tvOS+UIScrollView.swift 100% <100%> (ø)
...Extensions/Delegate+iOS+Extensions+Exclusive.swift 41.3% <33.33%> (ø)
Sources/iOS/Classes/ComponentFlowLayout.swift 69.16% <42%> (+16.76%) :arrow_up:
Sources/iOS/Classes/Component.swift 90.16% <81.25%> (+25.41%) :arrow_up:
Sources/iOS/Classes/DefaultItemView.swift 80.64% <0%> (-6.46%) :arrow_down:
Sources/Shared/Extensions/Codable+Extensions.swift 57.77% <0%> (+2.22%) :arrow_up:
Sources/Shared/Structs/Registry.swift 73.07% <0%> (+3.84%) :arrow_up:
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1626cf2...db0b2ac. Read the comment docs.