Uses native implementation when available
Checklist
- [x] All tests are passed.
- [ ] Added tests.
- [ ] Documented the code using Xcode markup.
- [x] Searched existing pull requests for ensure not duplicated.
Description
This change aims to use the native diffable data source implementation whenever possible (which at this point is 90% of times). This avoids some small API discrepancies and bugs that have been fixed.
Related Issue
https://github.com/ra1028/DiffableDataSources/issues/42
Motivation and Context
This library has always (wisely) aimed at closely mimicking the native API because of its temporary nature. Ideally we don't want to have to use backports. But while we can't target the API we need, they are invaluable to adopt newer tech. In the case of DiffableDataSources though, we must use the backport even for the latest OS versions, which is unfortunate. The "sister" library I met along with this one was IBPCollectionViewCompositionalLayout, and it very neatly and transparently uses the backport only when the native API is not available. This is the aim of this PR. To make the transition to fully native as seamless as possible. Just remove the shims when you can and you're good to go.
Impact on Existing Code
I have wrapped native API under the existing code, so as far as I can understand there is no impact. I simply carry a native instance when the OS allows, and skip the backport one. I introduced internal init methods that enable forcing the backport so the tests could focus on testing the backports instead of what's available on the simulator running the tests. The public API is still the exact same.