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

SmoothScrolling: Images not loading or taking too long while scrolling fast #20

Open
Michelasso opened this issue Aug 6, 2018 · 4 comments

Comments

@Michelasso
Copy link

Michelasso commented Aug 6, 2018

Hi,

I have read your tutorial so I decided to check the full sample code, also to port it to tvOS (but I get the same exact issues in iOS). I have run many tests, also trying to fix it myself (fat chance!) and when fast scrolling in a way or another something goes wrong. Either few images do not get loaded at all or they may take even 10 seconds to show.

I have put some extra logging and it seems like the old operations get executed even if the current cell is much far away. (I mean, something like #311 and following are loading, with many other is the middle, while #663 is showing) That would increase the time to load, I suppose. Then there is the issue of some avatars not showing at all, but they show later scrolling aways and then back.

Then I noticed that just after launch the first page gets loaded twice. But if I define the page size as the number of visible elements:

userViewModelController.retrieveUsers(pageSize: collectionView.visibleCells.count)
where in retrieveUsers() I added the parameter "pageSize" it seems to be fixed.

Last but not least... Any idea why I get this warning? It spams everywhere!

2018-08-06 11:28:15.665341+0200 CollectionView-tvOS[976:181832] prepareGeometry:1604: *** kCGColorSpaceModelRGB: bad numberOfChannels '3' for alphaInfo 'kCGImageAlphaNoneSkipFirst'
2018-08-06 11:28:15.670490+0200 CollectionView-tvOS[976:179840] prepareGeometry:1604: *** kCGColorSpaceModelRGB: bad numberOfChannels '3' for alphaInfo 'kCGImageAlphaNoneSkipFirst'

Actually i see that a big slowdown is caused by those messages, so they may be the root of the problem. I know it is just a tutorial, but it would help me greatly to understand why sometime it goes banana. Thanks!

PS: I forgot to mention that I am using Xcode 10 beta, iOS 12 beta and tvOS beta. Although with other programs I made using collection views the last issue doesn't present itself. Still if it works just fine for you it might be something with my environment.

@Michelasso
Copy link
Author

It was the beta OS... I have found out that it gave that message when executing

image = UIImage(data: data)

inside the function to download the images. Now I have just installed tvOS 12 beta 6 and that message eventually disappeared. Also MUCH improving the performances. Some images still do not get loaded, though, and they may still take few seconds to replace the avatar. Unless it is still caused by the beta OS, sure.

@andrea-prearo
Copy link
Owner

Thanks for the update @Michelasso!
I never tried the samples on tvOS. Especially on a real device. So, it's possible that there are some bugs or even just some portions of the code that don't perform particularly well.

@Michelasso
Copy link
Author

Hi @andrea-prearo, thanks for answering!

I actually get the same identical issues on iOS, tested on my iPad. Again, I have all my devices on beta OS (plus Xcode 10 beta), so that is most likely causing issues itself (it does for sure with the BoringSSL now, a new warning message appearing in iOS/tvOS 12 beta 6, slowing down the execution and thus probably ruining again the flow). The first page gets loaded twice by the app, though.

Oh well, in few weeks they'll all go GM, so I'll know better. Thanks again!

@andrea-prearo
Copy link
Owner

Sounds good. Thanks!

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