How do I make an UIImage/-View with rounded corners CGRect (Swift)

For rounded circle image frame in swift, what it worked for me was:

self.profileImageView.image =  UIImage(named:"profileUser")
self.profileImageView.layer.cornerRadius = self.profileImageView.frame.size.width / 2
self.profileImageView.clipsToBounds = true

And for adding a shadow:

self.profileImageView.layer.masksToBounds = NO;
self.profileImageView.layer.cornerRadius = 8;
self.profileImageView.shadowOffset = CGSizeMake(5.0, 5.0);
self.profileImageView.shadowRadius = 5;
self.profileImageView.shadowOpacity = 0.5;

let imageView = UIImageView(frame: CGRectMake(0, 0, 100, 100))
imageView.backgroundColor = UIColor.redColor()
imageView.layer.cornerRadius = 8.0
imageView.clipsToBounds = true

Result:

enter image description here