Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leoiphonedev/b175544c3b39865ed54edce789fe5424 to your computer and use it in GitHub Desktop.
Save leoiphonedev/b175544c3b39865ed54edce789fe5424 to your computer and use it in GitHub Desktop.
How to add shadow to all sides of UIView in swift 4
self.cntView.layer.cornerRadius = 13.0
self.cntView.layer.shadowColor = UIColor.lightGray.cgColor
self.cntView.layer.shadowOpacity = 0.5
self.cntView.layer.shadowRadius = 10.0
self.cntView.layer.shadowOffset = .zero
self.cntView.layer.shadowPath = UIBezierPath(rect: self.cntView.bounds).cgPath
self.cntView.layer.shouldRasterize = true
//Note:- cntView is an IBOutlet
//@IBOutlet weak var cntView: UIView!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment