Skip to content

Instantly share code, notes, and snippets.

@JasonCanCode
Created October 17, 2019 14:57
Show Gist options
  • Save JasonCanCode/5583dc10802ef16cd922ad531a2352f8 to your computer and use it in GitHub Desktop.
Save JasonCanCode/5583dc10802ef16cd922ad531a2352f8 to your computer and use it in GitHub Desktop.
For when you work with a designer that goes crazy with the shadows
import UIKit
extension UIView {
func addShadow() {
layer.shadowColor = UIColor.black.cgColor
layer.shadowOpacity = 0.15
layer.shadowOffset = CGSize(width: 0, height: 3.0)
layer.shadowRadius = 4
layer.masksToBounds = false
}
func addUpwardsShadow() {
layer.shadowColor = UIColor.black.cgColor
layer.shadowOpacity = 0.10
layer.shadowOffset = CGSize(width: 0, height: -3.0)
layer.shadowRadius = 4
layer.masksToBounds = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment