Skip to content

withAnimation completion callback is not invoked #724

@Dark-Existed

Description

@Dark-Existed
struct AniTestView: View {
    @State var offset: CGFloat = 0

    var body: some View {
        Color.red
            .frame(width: 100, height: 100)
            .offset(x: offset)
            .onAppear {
                withAnimation(.linear(duration: 4)) {
                    offset = 200
                } completion: {
                    print("done")
                }
            }
    }
}

The completion callback of withAnimation(_:completion:) does not take effect.
The animation itself runs as expected, but the completion closure is never called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: animationAnimation, transitions, transactions, or timing behavior.type: bugSomething is not working correctly.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions