How to detect the view is animating by UIViewPropertyAnimator

Updated
Jun 5, 2021 2:45 PM
Created
Jun 5, 2021 2:45 PM
Tags
UIKit.framework
Keywords


extension UIView {

  var isAnimatingByPropertyAnimator: Bool {
    (layer.animationKeys() ?? []).contains(where: { $0.hasPrefix("UIPacingAnimationForAnimatorsKey") })
  }

}