             addSubview(_leftView)
             
             let leftViewCenterY = NSLayoutConstraint(item: _leftView,
-                                                     attribute: .CenterY,
-                                                     relatedBy: .Equal,
+                                                     attribute: .centerY,
+                                                     relatedBy: .equal,
                                                      toItem: self,
-                                                     attribute: .CenterY,
+                                                     attribute: .centerY,
                                                      multiplier: 1.0,
                                                      constant: 0.0)
             
             let leftViewLeading = NSLayoutConstraint(item: _leftView,
-                                                     attribute: .Leading,
-                                                     relatedBy: .Equal,
+                                                     attribute: .leading,
+                                                     relatedBy: .equal,
                                                      toItem: self,
-                                                     attribute: .Leading,
+                                                     attribute: .leading,
                                                      multiplier: 1.0,
                                                      constant: edgeInsets.left)
             
             let leftViewWidth = NSLayoutConstraint(item: _leftView,
-                                                   attribute: .Width,
-                                                   relatedBy: .Equal,
+                                                   attribute: .width,
+                                                   relatedBy: .equal,
                                                    toItem: nil,
-                                                   attribute: .NotAnAttribute,
+                                                   attribute: .notAnAttribute,
                                                    multiplier: 1.0,
                                                    constant: 0)
-            leftViewWidth.priority = 1
+            leftViewWidth.priority = UILayoutPriority(rawValue: 1)
             
             addConstraints([leftViewCenterY, leftViewLeading, leftViewWidth])
         }

        layoutIfNeeded()
        _bottomConstraint.constant = bounds.height
        
        let delay = toastDuration == nil ? Double(_label.text!.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)) * 0.1 : toastDuration!
        
        UIView.animateWithDuration(animateDuration, delay: delay, options: .CurveEaseInOut, animations: {
            self.layoutIfNeeded()
        }) { (bol) in
            self.removeFromSuperview()
        }
    }
}
            
            
            let rightViewCenterY = NSLayoutConstraint(item: _rightView,
                                                      attribute: .centerY,
                                                      relatedBy: .equal,
                                                      toItem: self,
                                                      attribute: .centerY,
                                                      multiplier: 1.0,
                                                      constant: 0.0)
            
            let rightViewTrailing = NSLayoutConstraint(item: _rightView,
                                                       attribute: .trailing,
                                                       relatedBy: .equal,
                                                       toItem: self,
                                                       attribute: .trailing,
                                                       multiplier: 1.0,
                                                       constant: -edgeInsets.right)
            
            let rightViewWidth = NSLayoutConstraint(item: _rightView,
                                                    attribute: .width,
                                                    relatedBy: .equal,
                                                    toItem: nil,
                                                    attribute: .notAnAttribute,
                                                    multiplier: 1.0,
                                                    constant: 0)
            rightViewWidth.priority = UILayoutPriority(rawValue: 1)
            
            addConstraints([rightViewCenterY, rightViewTrailing, rightViewWidth])
        }
        
        
        // Adding a label
        _label = UILabel(frame: .zero)
        _label.translatesAutoresizingMaskIntoConstraints = false
        _label.textColor = textColor
        _label.numberOfLines = 0
        _label.lineBreakMode = .byWordWrapping
        _label.font = font
        _label.textAlignment = textAlignment
        addSubview(_label)
        
        addConstraint(NSLayoutConstraint(item: _label,
                                         attribute: .centerY,
                                         relatedBy: .equal,
                                         toItem: self,
                                         attribute: .centerY,
                                         multiplier: 1.0,
                                         constant: 0.0))
        
        addConstraint(NSLayoutConstraint(item: _label,
                                         attribute: .trailing,
                                         relatedBy: .equal,
                                         toItem: _haveRightView ? rightView : self,
                                         attribute:  _haveRightView ? .leading : .trailing,
                                         multiplier: 1.0,
                                         constant: -edgeInsets.right))
        
        addConstraint(NSLayoutConstraint(item: _label,
                                         attribute: .leading,
                                         relatedBy: .equal,
                                         toItem: _haveLeftView ? leftView : self,
                                         attribute: _haveLeftView ? .trailing : .leading,
                                         multiplier: 1.0,
                                         constant: edgeInsets.left))
        
    }
    
