func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
guard let vcIndex = viewControllerList.index(of: viewController) else {return nil}
let nextIndex = vcIndex + 1
guard viewControllerList.count != nextIndex else { return nil}
guard viewControllerList.count > nextIndex else {return nil}
return viewControllerList[nextIndex]
}
Because I'm returning nil when there's not a next view controller to show, the scrolling just scrolls off to an empty VC. I'm wanting when it's the final VC to not allow any more scrolling to the right.
Solutions I've seen just completely shut off the gesture recognizer but then don't really show how to reenable it and I don't think it's what I'm looking for.