Created
July 18, 2019 16:10
-
-
Save ahmedk92/0180d6ae484fa4e25468ed0b52a8abbf to your computer and use it in GitHub Desktop.
UIPageViewController setViewControllers not calling dataSource methods fix
This file contains hidden or 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
| class PageViewController: UIPageViewController { | |
| override func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) { | |
| super.setViewControllers(viewControllers, direction: direction, animated: animated) { (isFinished) in | |
| if isFinished && animated { | |
| DispatchQueue.main.async { | |
| super.setViewControllers(viewControllers, direction: direction, animated: false, completion: nil) | |
| } | |
| } | |
| completion?(isFinished) | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just wrapped this solution in a subclass.