         return keys.count > 0
     }
     
+    /// private properties for resuming
+    fileprivate weak var prevSuperlayer: CALayer?
+    fileprivate var prevLayerIndex: Int?
+    
     // MARK: - Initializer
 
     override public init() {

            red: 0, green: 0.455, blue: 0.756, alpha: 0.45).cgColor
        
        NotificationCenter.default.addObserver(self,
                                                         selector: #selector(recreate),
                                                         name: NSNotification.Name.UIApplicationDidBecomeActive,
                                                         object: nil)
    }
    
    override public init(layer: Any) {

    
    // MARK: - Internal Methods
    
    internal func save() {
        prevSuperlayer = superlayer
        prevLayerIndex = prevSuperlayer?.sublayers?.index(where: {$0 === self})
    }

    internal func resume() {
        if let prevSuperlayer = prevSuperlayer, let prevLayerIndex = prevLayerIndex {
            prevSuperlayer.insertSublayer(self, at: UInt32(prevLayerIndex))
        }
        if pulse.superlayer == nil {
            addSublayer(pulse)
        }
        let isAnimating = pulse.animation(forKey: kPulsatorAnimationKey) != nil
        // if the animationGroup is not nil, it means the animation was not stopped
        if let animationGroup = animationGroup, !isAnimating {
            pulse.add(animationGroup, forKey: kPulsatorAnimationKey)
        }
    }
    
    internal func recreate() {
        guard animationGroup != nil else { return }        // Not need to be recreated.
        stop()
