Search code examples
iosswiftswift3uipageviewcontroller

swift 3 trigger on container view contents update


I have a view controller containing a container view. This container view is being used to show an UIPageViewController and its various pages. The view containing the container view also contains a navigation bar at the top of the page - which has the Page Control item in it.

This is the arrangement: Screenshot

When it runs, I can swipe between the green and blue view controllers, and the navigation bar doesn't move. How do I update the Page Control to show which page I am on?


Solution

  • You should use UIPageViewControllerDataSource

    func presentationCount(for: UIPageViewController)
    func presentationIndex(for: UIPageViewController)