     }
     
     public func removeFromSuperview(animated: Bool, completion: ((Bool) -> Void)? = nil) {
-        UIView.animate(withDuration: 0.3, animations: {
+        let animaDuration: Double = animated ? 0.3 : 0
+        UIView.animate(withDuration: animaDuration, animations: {
             self.alpha = 0
         }, completion: { finished in
-            if finished {
-                self.removeFromSuperview()
-            }
+            
+            self.removeFromSuperview()
             if let completion = completion {
                 completion(finished)
             }

            loadingView.alpha = 0
            UIView.animate(withDuration: 0.3, animations: {
                loadingView.alpha = 1.0
            }, completion: completion)
        } else if let completion = completion {
            completion(true)
        }
    }
    
    public class func removeLoadingViews(inView view: UIView, animated: Bool) {
        view.subviews.forEach { view in
            if let loadingView = view as? LoadingView {
                loadingView.removeFromSuperview(animated: animated)
            }
        }
    }


// MARK: UIView extensions
public extension UIView {
    public func removeLoadingViews(animated: Bool, completion: ((Void) -> Void)? = nil) {
        LoadingView.removeLoadingViews(inView: self, animated: animated, completion: completion)
    }
}
