Skip to content

Commit

Permalink
Update CoreAnimationLayer.isAnimationPlaying to respect pending ani…
Browse files Browse the repository at this point in the history
…mation set by `AnimationView` (#1727)
  • Loading branch information
oblador authored Aug 23, 2022
1 parent 26f0762 commit 38a3b44
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sources/Private/CoreAnimation/CoreAnimationLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 38a3b44

Please sign in to comment.