user10469417
user10469417

Reputation:

How to add shadow for 3 sides only with corner radius in swift?

I have a UIView and I want to add shadow for leading, trailing & bottom with corner radius. I have added the function but even of no use.

extension UIView {
   func drawShadowwithCorner() {
      let layer = self.layer
      layer.shadowColor = UIColor.black.cgColor
      layer.shadowOffset = CGSize(width: 0, height: 0.2)
      layer.shadowOpacity = 0.2
      layer.shadowRadius = 5
      layer.cornerRadius = 12
   }
}

Upvotes: 0

Views: 430

Answers (1)

stoikokolev
stoikokolev

Reputation: 517

The answer of Ryan Pools here should work for you. The topic is similar.

Upvotes: 2

Related Questions