When user changed page in haste, indicator may haven't correct index.
So, recommend controlling indicator manually
this is example for controlling indicator.
// Allocate PageVC's UIPageControl in some initiate point.
private weak var pageControl: UIPageControl?
private var candidateIndex = 0
extension PageVC: UIPageViewControllerDelegate {
func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
// I use view tag for page indexing.
candidateIndex = pendingViewControllers[0].view.tag
}
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
// Sometimes, pendingVC and previousVC was same, it means page didn't changed yet. then, we need to guard in that situation.
guard candidateIndex != previousViewControllers[0].view.tag, completed else {return}
pageControl?.currentPage = candidateIndex
}
}