 class JHProgressHUD: UIView
 {
     
-    private var backGroundView : UIView?
-    private var progressIndicator : UIActivityIndicatorView?
-    private var titleLabel : UILabel?
-    private var footerLabel : UILabel?
+    fileprivate var backGroundView : UIView?
+    fileprivate var progressIndicator : UIActivityIndicatorView?
+    fileprivate var titleLabel : UILabel?
+    fileprivate var footerLabel : UILabel?
     
     var headerColor : UIColor
     var footerColor : UIColor
     var backGroundColor : UIColor
     var loaderColor : UIColor
-
-    class var sharedHUD : JHProgressHUD {
-    struct Static {
-        static var instance : JHProgressHUD?
-        static var token : dispatch_once_t = 0
-        }
-        dispatch_once(&Static.token) {
-            Static.instance = JHProgressHUD()
-        }
-        return Static.instance!
-    }
+    
+    static let sharedHUD = JHProgressHUD()
     
     init()
     {
         //Initialising Code
-        headerColor = UIColor.whiteColor()
-        footerColor = UIColor.whiteColor()
-        backGroundColor = UIColor.blackColor()
-        loaderColor = UIColor.whiteColor()
-        super.init(frame: CGRectZero)
-    }
-
+        headerColor = UIColor.white
+        footerColor = UIColor.white
+        backGroundColor = UIColor.black
+        loaderColor = UIColor.white
+        super.init(frame: CGRect.zero)
+    }
+    
     required init(coder aDecoder: NSCoder)
     {
-        headerColor = UIColor.whiteColor()
-        footerColor = UIColor.whiteColor()
-        backGroundColor = UIColor.blackColor()
-        loaderColor = UIColor.whiteColor()
-        super.init(coder: aDecoder)
+        headerColor = UIColor.white
+        footerColor = UIColor.white
+        backGroundColor = UIColor.black
+        loaderColor = UIColor.white
+        super.init(coder: aDecoder)!
     }
     
     override init(frame: CGRect)
     {
-        headerColor = UIColor.whiteColor()
-        footerColor = UIColor.whiteColor()
-        backGroundColor = UIColor.blackColor()
-        loaderColor = UIColor.whiteColor()
+        headerColor = UIColor.white
+        footerColor = UIColor.white
+        backGroundColor = UIColor.black
+        loaderColor = UIColor.white
         super.init(frame: frame)
     }
     
     // MARK: -Public Methods
     
     // Show the loader added to the mentioned view with the provided title and footer texts
-    func showInView(view : UIView, withHeader title : String?, andFooter footer : String?)
+    func showInView(_ view : UIView, withHeader title : String?, andFooter footer : String?)
     {
         self.hide()
         self.frame = view.frame
         setIndicator()
         
-        if title != nil && !isCleanedStringEmpty(title)
+        if title != nil && !isCleanedStringEmpty(title!)
         {
             setTitleLabel(title!)
-            titleLabel!.frame = CGRectMake(0, 0, getLabelSize().width, getLabelSize().height)
-        }
-        if footer != nil && !isCleanedStringEmpty(footer)
+            titleLabel!.frame = CGRect(x: 0, y: 0, width: getLabelSize().width, height: getLabelSize().height)
+        }
+        if footer != nil && !isCleanedStringEmpty(footer!)
         {
             setFooterLabel(footer!)
-            footerLabel!.frame = CGRectMake(0, 0, getLabelSize().width, getLabelSize().height)
+            footerLabel!.frame = CGRect(x: 0, y: 0, width: getLabelSize().width, height: getLabelSize().height)
         }
         setBackGround(self)
-        if title != nil && !isCleanedStringEmpty(title)
+        if title != nil && !isCleanedStringEmpty(title!)
         {
             titleLabel!.frame.origin = getHeaderOrigin(backGroundView!)
             titleLabel?.adjustsFontSizeToFitWidth = true
             backGroundView?.addSubview(titleLabel!)
         }
-        if footer != nil && !isCleanedStringEmpty(footer)
+        if footer != nil && !isCleanedStringEmpty(footer!)
         {
             footerLabel!.frame.origin = getFooterOrigin(backGroundView!)
             footerLabel?.adjustsFontSizeToFitWidth = true

    
    // MARK: -Set view properties
    
    private func setBackGround(view : UIView)
    {
        if backGroundView?.superview != nil
        {
            backGroundView?.removeFromSuperview()
            var aView = backGroundView?.viewWithTag(1001) as UIView?
            aView?.removeFromSuperview()
        }
        backGroundView = UIView(frame: getBackGroundFrame(self))
        backGroundView?.backgroundColor = UIColor.clearColor()
        var translucentView = UIView(frame: backGroundView!.bounds)
        translucentView.backgroundColor = backGroundColor
        translucentView.alpha = 0.85
        translucentView.tag = 1001;

        self.addSubview(backGroundView!)
    }
    
    fileprivate func setIndicator()
    {
        if progressIndicator?.superview != nil
        {
            progressIndicator?.removeFromSuperview()
        }
        progressIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
        progressIndicator?.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.whiteLarge
        progressIndicator?.color = loaderColor
        progressIndicator?.backgroundColor = UIColor.clear
        progressIndicator?.startAnimating()
    }
    
    fileprivate func setTitleLabel(_ text : String)
    {
        if titleLabel?.superview != nil
        {
