From d81cb39e45a8435fbd36fddee797bec192b6d9d7 Mon Sep 17 00:00:00 2001 From: GiangVT Date: Tue, 2 Sep 2025 11:23:40 +0700 Subject: [PATCH] Fix issue completion block is not called when user repeatedly presses spin button to call startRotationAnimation multiple times. - Reason: completion block has been released even though animation count > 1 --- .../Utils/Animation/SpinningWheelAnimator.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftFortuneWheel/Utils/Animation/SpinningWheelAnimator.swift b/Sources/SwiftFortuneWheel/Utils/Animation/SpinningWheelAnimator.swift index 5ac3685..111931d 100644 --- a/Sources/SwiftFortuneWheel/Utils/Animation/SpinningWheelAnimator.swift +++ b/Sources/SwiftFortuneWheel/Utils/Animation/SpinningWheelAnimator.swift @@ -160,7 +160,9 @@ extension SpinningWheelAnimator: CAAnimationDelegate { if let completionBlock = self.completionBlock, let animId = anim.value(forKey: "animId") as? String, animId == "rotation" { completionBlock(flag) - self.completionBlock = nil + if startedAnimationCount < 1 { + self.completionBlock = nil + } } startedAnimationCount -= 1 if startedAnimationCount < 1 {