Skip to content

Update fails if the cell is not visible #47

@Sydney-o9

Description

@Sydney-o9

If the UICollectionViewCell being updated is not visible, the update will trigger wrong cell type:

case .update(let indexPath, let object):
    guard let cell = self.collectionView.cellForItem(at: indexPath) as? Cell else { fatalError("wrong cell type") }
    self.delegate.configure(cell, for: object)

https://github.com/objcio/core-data/blob/master/Moody/Moody/CollectionViewDataSource.swift#L69-L70

I'm sure there must be a reason, but why not use this instead:

case .update(let indexPath, let object):
    self.collectionView.reloadItems(at: [indexPath])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions