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

Template not animating on collection cell #18

Open
leocallas opened this issue May 3, 2024 · 0 comments
Open

Template not animating on collection cell #18

leocallas opened this issue May 3, 2024 · 0 comments

Comments

@leocallas
Copy link

leocallas commented May 3, 2024

I have 3 dummy items in data for shimmer but only third one is animating after I scroll the horizontal collectionView, which is offscreen before you scroll. The first and second items is not animating. Any clues or possible solutions?

extension NewsCollectionTableViewCell: UICollectionViewDelegate, UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        data.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        guard 
            let cell: NewsCollectionViewCell = collectionView.dequeueCell(withType: NewsCollectionViewCell.self, for: indexPath),
            let model = data.item(at: indexPath.item)
        else { return .init() }
        cell.setup(with: model)
        return cell
    }
    
    func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
        cell.setTemplateWithSubviews(isLoading, viewBackgroundColor: .themeBackground)
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant