Improve update handling more

This commit is contained in:
Adlai Holler
2016-06-23 16:58:23 -07:00
parent 35056f708b
commit 9c70cec8d8

View File

@@ -498,18 +498,21 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)insertSections:(NSIndexSet *)sections - (void)insertSections:(NSIndexSet *)sections
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (sections.count == 0) { return; }
[_dataController insertSections:sections withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController insertSections:sections withAnimationOptions:kASCollectionViewAnimationNone];
} }
- (void)deleteSections:(NSIndexSet *)sections - (void)deleteSections:(NSIndexSet *)sections
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (sections.count == 0) { return; }
[_dataController deleteSections:sections withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController deleteSections:sections withAnimationOptions:kASCollectionViewAnimationNone];
} }
- (void)reloadSections:(NSIndexSet *)sections - (void)reloadSections:(NSIndexSet *)sections
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (sections.count == 0) { return; }
[_dataController reloadSections:sections withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController reloadSections:sections withAnimationOptions:kASCollectionViewAnimationNone];
} }
@@ -522,18 +525,21 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (indexPaths.count == 0) { return; }
[_dataController insertRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController insertRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone];
} }
- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (indexPaths.count == 0) { return; }
[_dataController deleteRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController deleteRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone];
} }
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
if (indexPaths.count == 0) { return; }
[_dataController reloadRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone]; [_dataController reloadRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone];
} }