Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help / Documentation needed #54

Open
RomainQuidet opened this issue May 3, 2019 · 1 comment
Open

Help / Documentation needed #54

RomainQuidet opened this issue May 3, 2019 · 1 comment
Labels

Comments

@RomainQuidet
Copy link

RomainQuidet commented May 3, 2019

Hi,

Thanks for this wonderful project.

I'm working with a UICollectionView with sections and items. I use differ API animateItemAndSectionChanges to animate my sections / items changes according to my data source.

Question 1

I can't find anyway to change the animation order (insert items first, delete after etc.). I saw Patch and Diff object, but no API to use them (except the apply buf NestedExtendedDiff does not allow ordering animation.

Question 2

Maybe not related to this project, but I have sections header / footer views, and after cells animation with differ, the headers are not correctly layout (the view moves up and down, and stay above cell). Small scroll or layout invalidation solves the issue... Strange.

Thanks.

@jenox
Copy link

jenox commented May 31, 2020

Hi @RomainQuidet!

To answer your first question, I don't think what you are trying to achieve is possible out of the box. When you call animateItemAndSectionChanges(oldData:newData:), you essentially transition between two states oldData and newData. Differ figures out at which index paths cells need to be inserted, deleted, or moved, and UIKit animates those accordingly. In terms of your data model, however, there are no intermediate states involved: your data source reports either oldValue or newValue when queried. If you want insertions to happen before deletions, then you need manually compute an intermediate state between oldValue and newValue, transition from oldValue to this intermediate state, and then from there to newValue.

Your second question sounds like a UIKit problem and nothing Differ can do something about. Have you tried using a regular UITableViewCell / UICollectionViewCell to draw the headers and footers? I haven't encountered any animation issues with those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants