This is a major API change so is in a v2 branch. If we agree on a direction we could start adding PRs in to this branch.
This change would enable multiple changes to be applied at once, e.g. by requiring balanced calls to
mappingDidEndUpdating and only performing the updates when an equal number of
mappingDidEndUpdating calls have been made. This could be a small performance improvement but would also improve animations.
By adding the
performUpdate closure the changes to the model layer can be applied only when the consumer is expecting them, e.g. for
UICollectionView this would be inside
performBatchUpdates and would fix the existing crashes that occur when performing a change when there are pending layout changes.
Some tests and types have been commented out since this is more of a starting point for a discussion around the API than it is a solid implementation.
This is the closest I can see the API being (although it's still a breaking change) but maybe a bigger change would be better.
The biggest PITA is that the sections need to keep track of "current" data (e.g. what's being displayed by a collection view) and the "pending" data (e.g. what's about to be applied). I don't think this adds any memory overhead but it does add much more to the knowledge required when implementing a section.