uias / Tabman

™️ A powerful paging view controller with interactive indicator bars
https://uias.github.io/Tabman
MIT License
2.86k stars 237 forks source link

Support for progressive infinite scrolling #537

Open mergesort opened 4 years ago

mergesort commented 4 years ago

New Issue Checklist

Issue Description

Hi @msaps, I was reading through the documentation and code and found no mention of infinite scrolling, but this closed issue alluded to it coming in version 2.0

I was wondering, is infinite scrolling something that's currently supported in Tabman? And if not, any chance you'd plan on adding support back in for it?

Thanks a lot!

msaps commented 4 years ago

@mergesort Infinite scrolling support is certainly available - TabmanViewController inherits from PageboyViewController which does all the paging magic. Docs are here - README.

But yes the property is isInfiniteScrollEnabled on TabmanViewController. Should improve the docs in Tabman for this 😄

mergesort commented 4 years ago

Thanks Merrick, that was rather helpful, now I realize why searching infinite in the Tabman code base rendered no results. 🙂

I do have a follow up question about the infinite scrolling animation. Currently the direction of the view controller animations and the tab bar's animations are in reverse order — when you reach the end of the list the view controllers animate smoothly, but the tab bar highlight animates by moving across the screen in the opposite direction.

(A zipped up example, couldn't upload the mov directly)

Infinite Animation.mov.zip

It's a bit jarring, I was expecting something more akin to a double buffered list for the tabs and was wondering if there's any way to replicate that effect so it feels like you've gone from the end to the beginning in a more seamless fashion?

msaps commented 4 years ago

@mergesort that is something I'd really like to improve - just haven't got around to it yet. The current implementation in Pageboy translates the 'infinite' offsets (beyond page bounds) to remain within the page bounds - so if you go beyond index 5 back to index 0 the page positions will traverse through 5, 4, 3, 2, 1, 0 rather than going above 5 which is why you see the current 'backwards' animation.

But yeah would require a bit of rework in the bar logic for sure - I'll reopen this to track it and hopefully can do something about it soon. If you have any ideas/approaches for how to tackle this would be much appreciated also!

mergesort commented 4 years ago

@msaps I haven't looked into it too deeply, but my naive approach would be similar to double buffering in game programming. The idea would be that you keep two copies of the tab bar back to back (3, 4, 0, 1, 2, 3, 4, 0, 1, 2 for example), which would allow you to have the animation progress forward. When the user reached the end (let's say there were 5 tabs, so index 4) and went back to 0, they would instead go to index 5 (which is identical in content to 0), and when the scrolling pauses, you would silently swap it with index 0.

This might be more complicated based on your implementation, I admittedly haven't taken a deep look at it, but I'm happy to talk through it some more or think on some other options if that doesn't make sense. 🙂

msaps commented 4 years ago

@mergesort cool - I'll see what I can do 😄

msaps commented 3 years ago

@mergesort just to give you an update here - currently working on it and planned for the v3.0.0 release! It's a little bit more complicated due to the different layout customisations (including accessory views / alignments and custom types) that Tabman has to support - but it's on the way 😄

Simulator Screen Shot - iPhone 12 Pro - 2020-11-11 at 08 10 31

mergesort commented 3 years ago

@msaps That's fantastic, thanks so much for the hard work!