onevcat / Kingfisher

A lightweight, pure-Swift library for downloading and caching images from the web.
MIT License
23.1k stars 2.64k forks source link

Fast scrolling of uncached images on tvOS #1743

Open goldenplan opened 3 years ago

goldenplan commented 3 years ago

Good afternoon! Please take a look, I came across an unpleasant bug. On tvOS, when quickly scrolling through cells that use KF with placeholder. In the case when the images are not yet cached. The focus is lost on the final cell. Video example: https://disk.yandex.ru/i/7wt5NLfeAeoKsQ Sample code: https://disk.yandex.ru/d/I6MfnITI-updxw

onevcat commented 3 years ago

Maybe try adjustsImageWhenAncestorFocused.

See https://github.com/onevcat/Kingfisher/blob/master/Demo/Demo/Kingfisher-Demo/ViewControllers/ImageCollectionViewCell.swift#L37

goldenplan commented 3 years ago

Good morning! No, unfortunately, it's not about this property. I'm putting it up in a storyboard. I tried it in the code, there is no result either. This is exactly the case somewhere inside Kingfisher. I will explain. The image goes into parallax when you hover the focus, but when you quickly scroll through uncached images, the parallax effect is not activated.

onevcat commented 3 years ago

I cannot reproduce it with you sample project. See the video below (in Apple TV 4K simulator with tvOS 14.5).

https://user-images.githubusercontent.com/1019875/127947580-7c868a61-05d2-4367-945a-e1ee389d6322.mp4

May I know what's your environment?

goldenplan commented 3 years ago

Good morning! No, there is nothing special about the environment. The problem repeats on 4gen, 4k, new_4k. I recorded another video. To repeat, you just need to scroll very quickly, repeating several quick swipes in a row. Two or more times, very quickly. With cached images, this problem will almost never occur. This time I recorded the video with new_4k.

https://disk.yandex.ru/i/0vpSJ0tmtjCGPg

onevcat commented 3 years ago

Ummm,

Thanks for the attached video. I still cannot reproduce this issue on my tvOS simulator. Maybe that is due to I am not scrolling quickly enough? I am using the virtual remote to control the interaction with the simulator. Is there any trick to scroll quickly enough so I can reproduce it?

And I am not an expert of tvOS developer (or say, I never created anything more than a demo on tvOS). Do you have any idea that what can cause it? Is it related something inside the focus engine? Is there anything we can try to locate the issue or make it more reproducible?

Thank you!