Skip to content

Template not animating on collection cell #18

@leocallas

Description

@leocallas

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)
    }

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