Created
May 12, 2021 08:55
-
-
Save marlonjames71/f58f63a63db45abe16a60999d5609c42 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: UIPageViewControllerDelegate { | |
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { | |
guard | |
let mediaVCs = pageViewController.viewControllers as? [MediaViewController], | |
let currIndex = mediaItems.firstIndex(of: mediaVCs[0].mediaItem) | |
else { return } | |
currentIndex = currIndex | |
} | |
// If you want to specify the interface orientations you want to support, implement these as well: | |
func pageViewControllerSupportedInterfaceOrientation(_ pageViewController: UIPageViewController) -> UIInterfaceOrientationMask { | |
// example | |
.allButUpsideDown | |
} | |
func pageViewControllerPreferredInterfaceOrientationForPresentation(_ pageViewController: UIPageViewController) -> UIInterfaceOrientationMask { | |
// example | |
.portrait | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment