I made a function to add a white mask under a UIView (if you are subclassing UIView)
func addBackgroundMask(){
backgroundMask = UIView()
backgroundMask?.backgroundColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.6)
backgroundMask?.setTranslatesAutoresizingMaskIntoConstraints(false)
let topConstraint = NSLayoutConstraint(item: backgroundMask!, attribute:NSLayoutAttribute.Top, relatedBy:NSLayoutRelation.Equal, toItem:superview, attribute:NSLayoutAttribute.Top, multiplier:1.0, constant:0.0)
let bottomConstraint = NSLayoutConstraint(item: backgroundMask!, attribute:NSLayoutAttribute.Bottom, relatedBy:NSLayoutRelation.Equal, toItem:superview, attribute:NSLayoutAttribute.Bottom, multiplier:1.0, constant:0.0)
let leftConstraint = NSLayoutConstraint(item: backgroundMask!, attribute:NSLayoutAttribute.Left, relatedBy:NSLayoutRelation.Equal, toItem:superview, attribute:NSLayoutAttribute.Left, multiplier:1.0, constant:0.0)
let rightConstraint = NSLayoutConstraint(item: backgroundMask!, attribute:NSLayoutAttribute.Right, relatedBy:NSLayoutRelation.Equal, toItem:superview, attribute:NSLayoutAttribute.Right, multiplier:1.0, constant:0.0)
superview?.insertSubview(backgroundMask!, belowSubview: self)
superview?.addConstraint(topConstraint)
superview?.addConstraint(bottomConstraint)
superview?.addConstraint(leftConstraint)
superview?.addConstraint(rightConstraint)
}