 
 import UIKit
 
+/// Helper enum for animation key
+fileprivate enum AnimationKeys: String {
+    case value = "value"
+}
+
+/// Helper extension to allow removing layer animation based on AnimationKeys enum
+fileprivate extension CALayer {
+    func removeAnimation(forKey key: AnimationKeys) {
+        self.removeAnimation(forKey: key.rawValue)
+    }
+}
+
 /**
  
  # UICircularProgressRing

     
     ## Important ##
     Animation duration = 0 will cause no animation to occur, and value will instantly
     be set
     
     ## Author
     Luis Padron
     */
    @objc open func startProgress(to value: ProgressValue, duration: ProgressDuration, completion: ProgressCompletion? = nil) {
        // Remove the current animation, so that new can be processed
        if isAnimating { self.layer.removeAnimation(forKey: "value") }
        // Only animate if duration sent is greater than zero
        self.ringLayer.animated = duration > 0
        self.ringLayer.animationDuration = duration
        // Create a transaction to be notified when animation is complete
        CATransaction.begin()
        CATransaction.setCompletionBlock {
            // Call the closure block
            self.delegate?.finishedUpdatingProgress?(for: self)
            completion?()
        }

        self.value = value
        CATransaction.commit()
    }

    /**
     This function allows animation of the animatable properties of the `UICircularProgressRing`.

            self.ringLayer.isClockwise = self.isClockwise
        }
    }

    /// Used to determine when the animation was paused
    private var animationPauseTime: CFTimeInterval?
