I have a class that subclasses UIPageViewController which contains 4 view controllers.
I am trying to figure out why the below code randomly stops the UIPageViewController from scrolling as I try to stop the bounce effect on the first and on the last controller on the UIPageViewController?
If you keep track of your currentIndex then the below should be sufficient but its a little buggy because there is a random scenario where it stops scrolling altogether and gets stuck on a random view controller.
I think the scrollView.bounces is a little buggy, perhaps I am missing something because most of the time it works fine, if anyone is able to have a solution based on the below it would be great please.
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
scrollView.bounces = currentIndex == 0 ||
currentIndex == controllers.count - 1
? false
: true
}
I managed to get this issue working but the problem I have is trying to figure out how I can scroll half way into the next controller.