From 38a3b443738dc16d36e673438f3924be429b711b Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Tue, 23 Aug 2022 16:48:58 +0200 Subject: [PATCH] Update `CoreAnimationLayer.isAnimationPlaying` to respect pending animation set by `AnimationView` (#1727) --- .../Private/CoreAnimation/CoreAnimationLayer.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift index 574643210e..5984880861 100644 --- a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +++ b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift @@ -329,11 +329,18 @@ extension CoreAnimationLayer: RootAnimationLayer { } var isAnimationPlaying: Bool? { - switch playbackState { + switch pendingAnimationConfiguration?.playbackState { case .playing: - return animation(forKey: #keyPath(animationProgress)) != nil - case nil, .paused: + return true + case .paused: return false + case nil: + switch playbackState { + case .playing: + return animation(forKey: #keyPath(animationProgress)) != nil + case nil, .paused: + return false + } } }