         loader.title = title
         loader.update()
         
-        NSNotificationCenter.defaultCenter().addObserver(loader, selector: #selector(loader.rotated(_:)),
-                                                         name: UIDeviceOrientationDidChangeNotification,
-                                                         object: nil)
-        
-        let height : CGFloat = UIScreen.mainScreen().bounds.size.height
-        let width : CGFloat = UIScreen.mainScreen().bounds.size.width
-        let center : CGPoint = CGPointMake(width / 2.0, height / 2.0)
+        NotificationCenter.default.addObserver(loader, selector: #selector(loader.rotated(notification: )),
+                                               name: NSNotification.Name.UIDeviceOrientationDidChange,
+                                               object: nil)
+        
+        let height : CGFloat = UIScreen.main.bounds.size.height
+        let width : CGFloat = UIScreen.main.bounds.size.width
+        let center : CGPoint = CGPoint(x: width / 2.0, y: height / 2.0)
         
         loader.center = center
         
         if (loader.superview == nil) {
             loader.coverView = UIView(frame: currentWindow.bounds)
-            loader.coverView?.backgroundColor = loader.config.foregroundColor.colorWithAlphaComponent(loader.config.foregroundAlpha)
+            loader.coverView?.backgroundColor = loader.config.foregroundColor.withAlphaComponent(loader.config.foregroundAlpha)
             
             currentWindow.addSubview(loader.coverView!)
             currentWindow.addSubview(loader)

        private var backgroundLayer : CAShapeLayer?
        private var isSpinning : Bool?
        
        private var config : Config = Config() {
            didSet {
                self.update()
            }

        }
        
        if (self.titleLabel == nil) {
            self.titleLabel = UILabel(frame: CGRect(origin: CGPoint(x: loaderTitleMargin, y: loaderSpinnerMarginTop + loadingViewSize), size: CGSize(width: self.frame.width - loaderTitleMargin*2, height:  42.0)))
            self.addSubview(self.titleLabel!)
            self.titleLabel?.numberOfLines = 1
            self.titleLabel?.textAlignment = NSTextAlignment.center
            self.titleLabel?.adjustsFontSizeToFitWidth = true
        } else {
            self.titleLabel?.frame = CGRect(origin: CGPoint(x: loaderTitleMargin, y: loaderSpinnerMarginTop + loadingViewSize), size: CGSize(width: self.frame.width - loaderTitleMargin*2, height: 42.0))
        }
        
        self.titleLabel?.font = self.config.titleTextFont
        self.titleLabel?.textColor = self.config.titleTextColor
        self.titleLabel?.text = self.title
        
        self.titleLabel?.isHidden = self.title == nil
    }
    
    func frameForSpinner() -> CGRect {
