Skip to content

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

@Michelasso

Description

@Michelasso

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions