Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marlonjames71/07160d447af97b8a43474942fd7fcca5 to your computer and use it in GitHub Desktop.
Save marlonjames71/07160d447af97b8a43474942fd7fcca5 to your computer and use it in GitHub Desktop.
extension PagedMediaViewController: UIPageViewControllerDataSource {
pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
guard currentIndex > 0 else { return nil }
return mediaViewControllerAtIndex(currentIndex - 1)
}
pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
guard currentIndex < mediaItems.count - 1 else { return nil }
return mediaViewControllerAtIndex(currentIndex + 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment