HeroTransitions / HeroTransitions/Hero

Animation not working for UICollectionViewDiffableDataSource

Open
#745 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
22.5k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

I am trying to use Hero to animate transitions into a screen that is rendered with UICollectionView with UICollectionViewDiffableDataSource, by calling apply snapshot (NSDiffableDataSourceSnapshot)

## What did you expect to happen?
To see the animation between the views that have matching hero ids

## What happened instead?
The screen appears with the hero fade only
On dismissing, the hero animations works perfectly (which removes the option that ids weren't defined properly, or any other setup issue)

From my investigation, if I add a delay of 2 seconds before presenting the screen, the animation works.
I also checked and saw that the the cells still didn't render when Hero tried to animate

Also, in another screen, that works with the same lifecycle exactly but without the diffable datasource, the hero animation works!
I also tried triggering apply snapshot without animations, or with the iOS 15 API (applySnapshotWithReloadData)

Is there a way to get this to work?

## General Information

* Hero Version:
latest

* iOS Version(s):
15.6.1

* Swift Version:
5
* Devices/Simulators:
iPhone 13 (real device)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.