Closed guidev closed 3 years ago
Hi @guidev!
If I understand well, your point is to show the original header when the collection is "skeletoned", isn't it? If so, your code doesn't do that, I mean, the library tries to get the identifier for the header/footer and if it's not defined by the developer, the library will obtain the view from the original data source, then, the view will be "skeletonized".
So, there were some ways to do it:
isSkeletonable
to false
, then the library will get the view but it won't do anything.func collectionSkeletonView(_ skeletonView: UICollectionView, prepareCellForSkeleton cell: UICollectionViewCell, at indexPath: IndexPath)
. Using this new method you can set isSkeletonable
to false
in runtime for whatever header/footer you want.BTW. I found an error if your collection has headers or footers and you don't implement the method
func collectionSkeletonView(_ skeletonView: UICollectionView, supplementaryViewIdentifierOfKind: String, at indexPath: IndexPath) -> ReusableCellIdentifier?
, the app crashes. With your code, if the identifier is not defined, the view will be provided by the original data source. So, we could merge it to solve this corner case. WDYT?
Thanks 🤙
Hi @guidev, could you check the message? I'd like to include the fix asap and if you don't want to do it, no problem, I'll do it :)
Please, let me know 👍🏼
Thanks
sounds good
Congratulations! 🎉 This was released as part of SkeletonView 1.21.0 🚀
Summary
Sometimes a collectionview's header doesn't need to be 'skeletoned' since it's already ready to be displayed, while the content needs more time to load.
When collectionSkeletonView(_ skeletonView: UICollectionView, supplementaryViewIdentifierOfKind: String, at indexPath: IndexPath) -> ReusableCellIdentifier? returns nil, it's best if we fallback to the non-skeleton, original header.
Requirements (place an
x
in each of the[ ]
)