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

Add animationDidFinish API to LottieView #2134

Merged
merged 2 commits into from
Aug 11, 2023
Merged

Conversation

calda
Copy link
Member

@calda calda commented Aug 10, 2023

This PR adds an animationDidFinish API to LottieView.

When using loopMode: .playOnce, or another finite duration animation like .repeat(3), this lets you know when the animation is complete.

For example, in the example app you can see we previously didn't update the "pause" button to the "play" state when the animation ended. Now we do:

.animationDidFinish { completed in
  if completed {
    animationPlaying = false
  }
}
Before After
2023-08-10 10 43 29 2023-08-10 10 59 35

Copy link
Contributor

@miguel-jimenez-0529 miguel-jimenez-0529 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N I C E

Sources/Public/Animation/LottieView.swift Outdated Show resolved Hide resolved
@calda calda enabled auto-merge (squash) August 11, 2023 22:59
Co-authored-by: Miguel Jimenez <miguel.jimenez.0529@gmail.com>
@calda calda merged commit 25b87a8 into master Aug 11, 2023
12 checks passed
@calda calda deleted the cal--animationDidFinish branch August 11, 2023 23:40
iago849 pushed a commit to atteamapps/lottie-ios that referenced this pull request Feb 8, 2024
MoroziOS pushed a commit to MoroziOS/tmg-lottie-ios that referenced this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants