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

[iOS] Async animations support #2117

Merged

Conversation

miguel-jimenez-0529
Copy link
Contributor

@miguel-jimenez-0529 miguel-jimenez-0529 commented Jul 26, 2023

This PR adds support for loading async animations from sources such as:

  • Dot Lottie file
  • Remote URL

The PR also

  • add a demo for remote URLs
  • Fix dot lottie animations demo

lottie-async-support

Comment on lines 60 to 64
LottieView {
await LottieAnimation.loadedFrom(url: url)
} placeholder: {
LoadingIndicator()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example call site for animation from URL

Comment on lines 83 to 87
LottieView {
try await DotLottieFile.named(animationName)
} placeholder: {
LoadingIndicator()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example callsite for loading a Dot lottie file

Copy link
Member

@calda calda left a comment

Choose a reason for hiding this comment

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

This is great, thank you @miguel-jimenez-0529!

I pulled your branch and experimented a bit to help myself understand the requirements. I did a bit of cleanup in LottieView itself and pushed a commit with those changes. lmk what you think.

Example/Example/AnimationPreviewView.swift Outdated Show resolved Hide resolved
Example/Example/AnimationPreviewView.swift Outdated Show resolved Hide resolved
Example/Example/AnimationPreviewView.swift Outdated Show resolved Hide resolved
.getRealtimeAnimationProgress(animationPlaying ? $sliderValue : nil)

LottieView {
try await lottieSource()
Copy link
Member

Choose a reason for hiding this comment

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

really nice :)

@calda calda enabled auto-merge (squash) July 26, 2023 20:44
auto-merge was automatically disabled July 26, 2023 20:56

Head branch was pushed to by a user without write access

@calda calda enabled auto-merge (squash) July 26, 2023 20:58
@calda calda merged commit 5f21ab0 into airbnb:master Jul 26, 2023
12 checks passed
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.

2 participants