New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improve Performance] ViewController for PageViewController should be initialized lazily #87
Comments
Or, I just have one more idea.
|
@muukii I agree completely. A more 'reusable' style data source would definitely be an improvement. Have currently got it planned for |
Raised an issue for the changes. #88 |
@msaps |
These changes are now available in the Pageboy 2.0 beta's 👍 Latest available here: 2.0.0 Beta 2. Expecting final release to be available alongside Swift 4.0 support around September time. |
@muukii @msaps |
Figured out the problem When initializing VC's for your datasource, if you perform configuration work in the initialization process, the VC will not be lazily loaded. Eg. var viewControllers: [UIViewController] = [] // Datasource
func loadVCS() {
let vc = UIViewController()
vc.view.backgroundColor = .black // This ensures this VC will be loaded even if it's not yet on screen. Remove it if you want the VC to be lazily loaded (ie. When you first scroll to it).
viewControllers.append(vc)
} |
PageViewController display ViewController as full screen.
Therefore, Next or Previous ViewController should not be initialized when they before displaying.
But, Current DataSource APIs require all ViewControllers.
I think that add below API likes UICollectionViewDataSource.
Example,
This API improves initialize performance when PageBoy has many viewControllers.
What do you think?
The text was updated successfully, but these errors were encountered: