Closed serjooo closed 4 years ago
As discussed with @ra1028 on the following PR adding completion block on DifferenceKit
is not an option marking this PR as irrelevant.
@serjooo Thanks for your PR. I don't prefer adding a completion block to DIfferenceKit, but I think possible it in DiffableDataSources because it's closer to the UI layer. I'll try to implement completion block with CATransaction to be exactly as official DiffableDataSource API.
Checklist
Description
This library provides a back port to
UITableViewDiffableDataSource
,UICollectionViewDiffableDataSource
, andNSCollectionViewDiffableDataSource
and tries to stay as close to the API as possible.However, one part of the API is missing for
UICollectionView
andUITableView
that does not exist forNSCollectionView
which is theCompletio
block of applying the difference.UIKIt
:apply(_:animatingDifferences:completion:)
AppKit
:applySnapshot:animatingDifferences:
However, to achieve this we would need to change the internals of
DifferenceKit
on thereload
method to accept acompletion
block and call it once it is done applying the difference.Motivation and Context
By providing a
completion
onapply
method, the API will be exactly as Apple's APIs.Impact on Existing Code
As Apple's API
completion
block is optional, the function parameter could default tonil
and this will not effect the client code and will not cause any breaking changes.