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/paginated scrolling on ios #809

Closed zenangst closed 6 years ago

zenangst commented 6 years ago

This improves paginated scrolling on iOS by manually implementing how the component should scroll instead of relying on isPagingEnabled which does not take content insets, section insets, and item spacing into account.

zenangst commented 6 years ago

I might need to revisit this to make it work with different spans I think, but it became kinda big.

codecov[bot] commented 6 years ago

Codecov Report

Merging #809 into master will decrease coverage by 1.08%. The diff coverage is 46.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #809      +/-   ##
==========================================
- Coverage   85.18%   84.09%   -1.09%     
==========================================
  Files         152      152              
  Lines       10488    10520      +32     
==========================================
- Hits         8934     8847      -87     
- Misses       1554     1673     +119
Flag Coverage Δ
#ios 82.91% <46.87%> (-0.28%) :arrow_down:
#osx 86.62% <ø> (ø) :arrow_up:
#tvos 82.07% <46.87%> (+7.69%) :arrow_up:
Impacted Files Coverage Δ
...ources/iOS/Extensions/Component+iOS+Carousel.swift 90.9% <ø> (-0.59%) :arrow_down:
Sources/iOS/Classes/ComponentFlowLayout.swift 67.65% <0%> (-7.44%) :arrow_down:
...ces/iOS/Extensions/Delegate+iOS+UIScrollView.swift 49% <86.66%> (+0.68%) :arrow_up:
Sources/iOS/Classes/Component.swift 90.87% <89.47%> (+0.1%) :arrow_up:
SpotsTests/tvOS/SpotsControllerTVOSTests.swift 0% <0%> (-100%) :arrow_down:
SpotsTests/tvOS/SpotsScrollViewTVOSTests.swift 0% <0%> (-100%) :arrow_down:
...potsTests/Shared/ComponentFocusDelegateTests.swift 0% <0%> (-86.37%) :arrow_down:
...es/iOS-Exclusive/Classes/SpotsScrollView+iOS.swift 88.67% <0%> (-11.33%) :arrow_down:
SpotsTests/iOS/ComponentDelegateiOSTests.swift 81.01% <0%> (-3.8%) :arrow_down:
...urces/iOS/Extensions/Delegate+iOS+Extensions.swift 88.88% <0%> (-1.24%) :arrow_down:

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 ed27638...3ebd3e1. Read the comment docs.

onmyway133 commented 6 years ago

As @vadymmarkov said 😬 I think it will be better if we add test right when we add/change the code instead of adding later ❤️

zenangst commented 6 years ago

@onmyway133 yeap tests should be added, however, I'm trying to cover the different scenarios that we have now. The current project has multiple variants which is kinda hard to cover in one go.