Merge pull request #4960 from stuartbreckenridge/main

🩹 Use completion handler in collection view.
This commit is contained in:
Brent Simmons authored and GitHub committed 2026-01-14 22:00:28 -08:00
commit 5defc4b065
1 file changed
+9 -9
@@ -446,7 +446,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
completion?()
return
}
collectionView.performBatchUpdates {
if let deletes = changes.deletes, !deletes.isEmpty {
collectionView.deleteSections(IndexSet(deletes))
@@ -479,17 +479,17 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
}
}
}
}
if let rowChanges = changes.rowChanges {
for rowChange in rowChanges {
if let reloads = rowChange.reloadIndexPaths, !reloads.isEmpty {
collectionView.reloadItems(at: reloads)
} completion: { finished in
if let rowChanges = changes.rowChanges {
for rowChange in rowChanges {
if let reloads = rowChange.reloadIndexPaths, !reloads.isEmpty {
self.collectionView.reloadItems(at: reloads)
}
}
}
}
completion?()
completion?()
}
}
func applyToAvailableCells(_ completion: (MainFeedCollectionViewCell, IndexPath) -> Void) {