Fix issue where supplementary elements don't track section changes (#404)

* Fix collection view supplementary issue

* Add a fast-path

* Remove the old index path entry unconditionally

* Handle overwriting bug
This commit is contained in:
Adlai Holler
2017-07-01 10:55:59 -07:00
committed by GitHub
parent 5e288c596e
commit fcb293e049
5 changed files with 50 additions and 17 deletions

View File

@@ -21,7 +21,7 @@
NS_ASSUME_NONNULL_BEGIN
@class ASSection, ASCollectionElement;
@class ASSection, ASCollectionElement, _ASHierarchyChangeSet;
/**
* This mutable version will be removed in the future. It's only here now to keep the diff small
@@ -47,12 +47,18 @@ AS_SUBCLASSING_RESTRICTED
- (void)removeSectionsOfItems:(NSIndexSet *)itemSections;
- (void)removeSupplementaryElementsInSections:(NSIndexSet *)sections;
- (void)insertEmptySectionsOfItemsAtIndexes:(NSIndexSet *)sections;
- (void)insertElement:(ASCollectionElement *)element atIndexPath:(NSIndexPath *)indexPath;
/**
* Update the index paths for all supplementary elements to account for section-level
* deletes, moves, inserts. This must be called before adding new supplementary elements.
*
* This also deletes any supplementary elements in deleted sections.
*/
- (void)migrateSupplementaryElementsWithChangeSet:(_ASHierarchyChangeSet *)changeSet;
@end
@interface ASElementMap (MutableCopying) <NSMutableCopying>