             
             
             let rightViewCenterY = NSLayoutConstraint(item: _rightView,
-                                                      attribute: .CenterY,
-                                                      relatedBy: .Equal,
+                                                      attribute: .centerY,
+                                                      relatedBy: .equal,
                                                       toItem: self,
-                                                      attribute: .CenterY,
+                                                      attribute: .centerY,
                                                       multiplier: 1.0,
                                                       constant: 0.0)
             
             let rightViewTrailing = NSLayoutConstraint(item: _rightView,
-                                                       attribute: .Trailing,
-                                                       relatedBy: .Equal,
+                                                       attribute: .trailing,
+                                                       relatedBy: .equal,
                                                        toItem: self,
-                                                       attribute: .Trailing,
+                                                       attribute: .trailing,
                                                        multiplier: 1.0,
                                                        constant: -edgeInsets.right)
             
             let rightViewWidth = NSLayoutConstraint(item: _rightView,
-                                                    attribute: .Width,
-                                                    relatedBy: .Equal,
+                                                    attribute: .width,
+                                                    relatedBy: .equal,
                                                     toItem: nil,
-                                                    attribute: .NotAnAttribute,
+                                                    attribute: .notAnAttribute,
                                                     multiplier: 1.0,
                                                     constant: 0)
-            rightViewWidth.priority = 1
+            rightViewWidth.priority = UILayoutPriority(rawValue: 1)
             
             addConstraints([rightViewCenterY, rightViewTrailing, rightViewWidth])
         }
         
         
         // Adding a label
-        _label = UILabel(frame: CGRectZero)
+        _label = UILabel(frame: .zero)
         _label.translatesAutoresizingMaskIntoConstraints = false
         _label.textColor = textColor
         _label.numberOfLines = 0
-        _label.lineBreakMode = .ByWordWrapping
+        _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))
+                                         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))
+                                         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))
+                                         attribute: .leading,
+                                         relatedBy: .equal,
+                                         toItem: _haveLeftView ? leftView : self,
+                                         attribute: _haveLeftView ? .trailing : .leading,
+                                         multiplier: 1.0,
+                                         constant: edgeInsets.left))
         
     }
     

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

public class HJToast: UIView {
    
    // Exposed properties
    public var font: UIFont = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.footnote)
    public var textColor: UIColor = UIColor.white
    public var textAlignment: NSTextAlignment = .center
    public var leftView: UIView?
    public var rightView: UIView?
    public var toastDuration: TimeInterval?
    public var animateDuration: TimeInterval = 0.25
    public var edgeInsets: UIEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
    
    
    
