      Stop animation when app send to background.
      */
     @objc private func appWillResignActive() {
+        wasAnimating = isAnimating
         stopAnimating()
     }
     

    /// A Bool value indicating whether the animation is running.
    open fileprivate(set) var isAnimating: Bool
    
    /// A Bool value indicating whether the animation should be 
    /// started automatically after an image is set. Default is false.
    open var autoStartAnimation: Bool {

     Start animation when app become active.
     */
    @objc func appDidBecomeActive() {
        if wasAnimating {
            startAnimating()
        }
    }
    
    /**
