Created
October 12, 2017 08:48
-
-
Save NikhilManapure/56619d762a061fdd5e357cf1e82a0149 to your computer and use it in GitHub Desktop.
Revisions
-
NikhilManapure created this gist
Oct 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ class CornerRadiusWithShadowView: UIView { var cornerRadius: CGFloat = 2.0 var shadowOffsetWidth: Double = 0.0 var shadowOffsetHeight: Double = 3.0 var shadowColor: UIColor = .black var shadowOpacity: Float = 0.5 override func layoutSubviews() { super.layoutSubviews() layer.cornerRadius = cornerRadius layer.masksToBounds = false layer.shadowColor = shadowColor.cgColor layer.shadowOffset = CGSize(width: shadowOffsetWidth, height: shadowOffsetHeight) layer.shadowOpacity = shadowOpacity let shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius) layer.shadowPath = shadowPath.cgPath } }