Advertisement
Andrey_ZoZ

MakeShadow

Jun 21st, 2021
1,284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.47 KB | None | 0 0
  1. extension UIView {
  2. func dropShadow(color: UIColor, opacity: Float = 0.3, offSet: CGSize, radius: CGFloat = 10, scale: Bool = true) {
  3.     layer.masksToBounds = false
  4.     layer.shadowColor = color.cgColor
  5.     layer.shadowOpacity = opacity
  6.     layer.shadowOffset = offSet
  7.     layer.shadowRadius = radius
  8.  
  9.     layer.shadowPath = UIBezierPath(rect: self.bounds).cgPath
  10.     layer.shouldRasterize = true
  11.     layer.rasterizationScale = scale ? UIScreen.main.scale : 1
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement