Last active
May 12, 2021 15:49
-
-
Save marlonjames71/07160d447af97b8a43474942fd7fcca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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