Reputation: 39
This is the code for corners:
self.newView.layer.cornerRadius = 5.0
self.newView.layer.clipsToBounds = true
Please help me with the shadow code as well.
Upvotes: 1
Views: 77
Reputation: 150605
You do add a shadow layer in a similar way:
newView.layer.cornerRadius = 5
newView.backgroundColor = .blue
newView.clipsToBounds = true
// shadow
newView.layer.shadowColor = UIColor.black.cgColor
newView.layer.shadowOpacity = 0.5
newView.layer.shadowOffset = CGSize(width: 10, height: 10)
newView.layer.shadowRadius = 10
newView.layer.masksToBounds = false
Upvotes: 3