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

Async loading of animation removes SwiftUI animation #2257

Closed
denandreychuk opened this issue Dec 13, 2023 · 1 comment · Fixed by #2289
Closed

Async loading of animation removes SwiftUI animation #2257

denandreychuk opened this issue Dec 13, 2023 · 1 comment · Fixed by #2289
Labels

Comments

@denandreychuk
Copy link

Suppose we have a simple animation view which loads DotLottie file:

@State private var flag = false

var body: some View {
    LottieView {
        try await DotLottieFile.named(animation)
    } placeholder: {
        Image(placeholder)
    }
    .looping()
    .resizable()
    .offset(y: flag ? 0 : 300)
    .onAppear {
        withAnimation {
            flag = true
        }
    }
}

The code above moves to offset 0 immediately, removing SwiftUI offset animation

@SoylentGraham
Copy link

Can I ask where you found the documentation for this style of loading?
I've spent the last hour trying to load data in 10 different ways, and then stumbled upon this example, which worked! :)

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

Successfully merging a pull request may close this issue.

3 participants