Skip to content
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

Why collectionView.window is nil if the pagingController is not visible ? #717

Open
aiKrice opened this issue Jun 6, 2024 · 2 comments
Open

Comments

@aiKrice
Copy link
Contributor

aiKrice commented Jun 6, 2024

Hello @rechsteiner
I have noticed that if I pop a viewcontroller and in a row I change the selectIndex of the PagingViewController nothing is visible because collectictionView.window is nil .

I had to perform a DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) to make it work
Any hint ?

File PagingController.swift, L67

@rechsteiner
Copy link
Owner

Hi! Yeah, the paging controller only allows changing the selected item when the view controller is visible. I guess you are calling select(pagingItem:) right after calling popViewController? In that case, the view controller will not yet be visible. Maybe you could use the completion handler on the transition controller like this?

navigationController.popViewController()
navigationController.transitionCoordinator?.animate(alongsideTransition: nil) { _ in
  // Select item
}

@aiKrice
Copy link
Contributor Author

aiKrice commented Sep 4, 2024

Hello !
Oh I will try and will come back to you :) Ty

@aiKrice aiKrice changed the title Why collectionView.window is nil is the pagingController is not visible ? Why collectionView.window is nil if the pagingController is not visible ? Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants