UICollectionUpdates
Wrapper for UITableView and UICollectionView model-oriented batch updates. Supports safe batch updates (In case of throw you can perform reloadData())
Usage
import UICollectionUpdates
let updates = UICollectionUpdates(
reloadIndexPaths: [IndexPath(item: 0, section: 0), IndexPath(item: 2, section: 0)],
deleteIndexPaths: [IndexPath(item: 1, section: 0)],
deleteSections: [1]
)
do {
try collectionView.perform(updates: updates, completion: { succeed in
print("The animation has been successfull: \(succeed)")
})
} catch {
// Inconsistent update
collectionView.reloadData()
}
Installation
CocoaPods
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'UICollectionUpdates'
end
Carthage
Add this to Cartfile
github "konshin/UICollectionUpdates" "0.1.4"
$ carthage update
Author
konshin, [email protected]
License
UICollectionUpdates is available under the MIT license. See the LICENSE file for more info.