Search code examples
iosswiftuipageviewcontrolleruipagecontrol

What function is called whenever a UIPageViewController is swiped?


I need to execute another function whenever an UIPageView is swiped.


Solution

  • Conform to UIPageViewControllerDelegate and implement the following methods:

    func pageViewController(UIPageViewController, willTransitionTo: [UIViewController]) {
        // called when swiping begins
    }
    
    func pageViewController(UIPageViewController, didFinishAnimating: Bool, previousViewControllers: [UIViewController], transitionCompleted: Bool) {
        // called when swiping ends
    }