Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #129, indexPath is not a reliable thing to use for disappearance announcements on deletion (either the index would be out of bounds if the last item is deleted or it will point to an invalid item).
Calling
- (void)announceWillAppearForItemInCell:(UICollectionViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
and- (void)announceDidDisappearForItemInCell:(UICollectionViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
guarantees the announcement will be dispatched to the component tree associated to the cell.It is however non opinionated in the sense that it won't do deduplication of events, or check for imbalanced calls.
For instance while reloading a cell on screen, the collection view first send appearance events for the newly created cell and then send disappearance events for the old cell, this situation should be handled properly in the controller layer. #153 has been opened to track these use cases and provide examples/code to deal with them.