onmyway133 / DeepDiff

🦀Amazingly incredible extraordinary lightning fast diffing in Swift
https://onmyway133.com/apps/
Other
2.05k stars 145 forks source link

IndexPath.section is always zero in the results #4

Closed richardtop closed 6 years ago

richardtop commented 6 years ago

While this issue is related to #1 , what I propose is to make DeepDiff applicable to calculate Diff in any section other than 0. Currently, the section number is hardcoded to be 0.

What I propose, is to add a section parameter to the API to generate valid IndexPaths, for example:

let changes = diff(old: oldItems, new: items, section: 4)
onmyway133 commented 6 years ago

@richardtop This makes sense. I will implement as you suggest 👍

onmyway133 commented 6 years ago

@richardtop Hi, I just made the changes, you can check https://github.com/onmyway133/DeepDiff/releases/tag/1.1.1

onmyway133 commented 6 years ago

@richardtop I think I will close this. Feel free to reopen it if you face any issues

richardtop commented 6 years ago

@onmyway133 didn't have a time to actually use these functions. I've used this library to prototype a reconciliation algorithm similar to react in iOS, backed by UICollectionView.

onmyway133 commented 6 years ago

@richardtop Hi, I built this DeepDiff for this https://github.com/hyperoslo/Upstream. Essentially I want UI to be driven by Model. In the future I would like to build something like Messengers UI or Forms based on Upstream, for every kinds of actions (input, text, selection) will trigger changes to model, hence reinvalidating all the cells