-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from daangn/feature/ben/MBP-6915-add-update-st…
…rategy-option MBP-6915 Adapter apply 인터페이스 개선
- Loading branch information
Showing
2 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Sources/KarrotListKit/Adapter/CollectionViewAdapterUpdateStrategy.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright (c) 2024 Danggeun Market Inc. | ||
// | ||
|
||
import Foundation | ||
|
||
/// The approaches for updating the content of a `UICollectionView`. | ||
public enum CollectionViewAdapterUpdateStrategy { | ||
|
||
/// Performs animated batch updates by calling `performBatchUpdates(…)` with the new content. | ||
case animatedBatchUpdates | ||
|
||
/// Performs non-animated batch updates by wrapping a call to `performBatchUpdates(…)` with the | ||
/// new content within a `UIView.performWithoutAnimation(…)` closure. | ||
/// | ||
/// More performant than `reloadData`, as it does not recreate and reconfigure all visible | ||
/// cells. | ||
case nonanimatedBatchUpdates | ||
|
||
/// Performs non-animated updates by calling `reloadData()`, which recreates and reconfigures | ||
/// all visible cells. | ||
/// | ||
/// UIKit engineers have suggested that we should never need to call `reloadData` on updates, | ||
/// and instead just use batch updates for all content updates. | ||
case reloadData | ||
} |