I have created a User Onboarding as a Collection View with 2 items.
The Collection View has a UIPageControl which shows an active page user currently on.
The problem is I can change the state of active UIPageControl dot only when the transition is ended, after user swiped to the next\previous screen.
This is how it looks now: GIF
I want the behaviour so when you start to swipe UIPageControl should already change its active dot onto the next\previous one without me necessarily ending the swipe (lift the finger).
You can check what I want on the gif: GIF
Here is how I change the UIPageControl dot now:
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let width = scrollView.frame.width
currentPage = Int(scrollView.contentOffset.x / width)
pageControl.currentPage = currentPage
}
How my code should be modified, which method to use to achieve the behaviour? I couldn't find any similar questions on StackOverflow.
Based on your question...
Instead of
scrollViewDidEndDecelerating, implement: