Skip to content

Commit

Permalink
fix: 빠르게 스크롤 내릴시 사진 배열 이상해지는 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
k2645 committed Dec 4, 2024
1 parent 395ba3d commit 99711c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class CustomAlbumCollectionViewCell: UICollectionViewCell {

return imageView
}()
var representedAssetIdentifier: String?

// MARK: - Initialize
override init(frame: CGRect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,13 @@ extension CustomAlbumViewController: UICollectionViewDataSource {
cell.setPhoto(.photo)
} else {
guard let asset = viewModel.photoAsset?[indexPath.item - 1] else { return cell }
cell.representedAssetIdentifier = asset.localIdentifier
let cellSize = cell.bounds.size
Task {
await LocalPhotoManager.shared.requestThumbnailImage(with: asset, cellSize: cellSize) { image in
cell.setPhoto(image)
if cell.representedAssetIdentifier == asset.localIdentifier {
cell.setPhoto(image)
}
}
}
}
Expand Down

0 comments on commit 99711c8

Please sign in to comment.