How to jump to a particular page with UIPageViewController?

Viewed 2937

I'm using Xcode 8's default Page-based application, and I'm stuck trying to jump to a particular page (as opposed to swiping left and right to turn). I have found similar questions on StackOverflow, but the answers mostly suggested using this method:

 setViewControllers:direction:animated:completion

I don't need to change the number of pages to be displayed, so can I avoid using setViewControllers?

After reading through Xcode's page-based application template, I think this function may work:

func viewControllerAtIndex(_ index: Int, storyboard: UIStoryboard) -> DataViewController?

However, I don't know where to get the parameter storyboard: UIStoryboard, since ModelController (the controller that serves as UIPageViewControllerDataSource) isn't part of the storyboard.

1 Answers
Related