SkeletonView
SkeletonView copied to clipboard
Collection View Hide Skeleton Bug - iOS 12.4
What did you do?
collectionView.showAnimatedGradientSkeleton()
Then after loading data collectionView.hideSkeleton()
What did you expect to happen?
Skeleton hides.
What happened instead?
The skeleton doesn't go away.
Steps to reproduce the behavior
Create collection view and run on iOS 12.4, show skeleton and then after delay hide the skeleton. This is not an issue on iOS 13.
SkeletonView Environment
SkeletonView version: 1.8.5 Xcode version: Version 11.3.1 (11C504) Swift version: 5
I 'm facing same issue. Did you find solution to it
I did not find a solution.
Hello, the same thing happened to me, I hope it works for you. In my case it was because the animation started in viewDidLoad, I put it in viewDidAppear and it was solved, but clarifying that the bug only plays for ios versions less than 13.
Hello, the same thing happened to me, I hope it works for you. In my case it was because the animation started in viewDidLoad, I put it in viewDidAppear and it was solved, but clarifying that the bug only plays for ios versions less than 13.
I tried it and the skeleton sometimes doesn't hide. I work around the issue by calling hide skeleton in cell for item while configuring the cell.
@giantramen after adding showAnimatedSkeleton
to prepareSkeleton
closure bug fixed (I tested on iOS 11)
collectionView.prepareSkeleton { _ in
self.collectionView.showAnimatedSkeleton(usingColor: .gray, animation: nil)
}
Some issues with tableviews not hiding and not hiding animated seem to be due in part to the changes to the setOpacity
method that were introduced here:
https://github.com/Juanpe/SkeletonView/commit/2f2e542d51e4ce213439e051ad913a89d58fd36e#diff-9eb1f0cbab2c306e2cdd6b5ca5d7df0cL142
Either removing the DispatchQueue.main.async {}
code that was introduced or putting the entire implementation within a single async block seems to improve the behavior.
@Juanpe I think there may be a minor issue with the setOpacity
method... at least for table views. See (https://github.com/Juanpe/SkeletonView/issues/277#issuecomment-629431593).
Do you recall why that code change was required as part of the bug fix? Specifically, why the things needed to be scheduled as 3 different async tasks instead of 1? Or why they needed to be async at all?
@Elshad solution did a trick for me. Thx!
prepareSkeleton
is an extension from UICollectionView, so it's supposed to prepare a collectionView for Skeleton manipulations👌🏻
Thanks @wcwynn for the research. Let me check it
Let's you guys when I have more info about that.
I found this issue on iOS 13 earlier.
Try call hideSketleton in next runloop worked:
DispatchQueue.main.async { self.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.2)) }