UICollectionUpdates
UITableView 和 UICollectionView 模型化批量更新的包装器。支持安全批量更新(如果在抛出异常时,您可以执行 reloadData())
使用
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()
}
安装
CocoaPods
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'UICollectionUpdates'
end
Carthage
将此添加到 Cartfile
github "konshin/UICollectionUpdates" "0.1.4"
$ carthage update
作者
konshin, [email protected]
许可证
UICollectionUpdates 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。