Created
March 4, 2016 22:36
-
-
Save spentak/3ce795de989019b7cae5 to your computer and use it in GitHub Desktop.
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 characters
import UIKit | |
private var materialKey = false | |
extension UIView { | |
@IBInspectable var materialDesign: Bool { | |
get { | |
return materialKey | |
} | |
set { | |
materialKey = newValue | |
if materialKey { | |
self.layer.cornerRadius = 3.0 | |
self.layer.shadowOpacity = 0.8 | |
self.layer.shadowRadius = 3.0 | |
self.layer.shadowOffset = CGSizeMake(0.0, 2.0) | |
self.layer.shadowColor = UIColor(red: 157.0/255.0, green: 157.0/255.0, blue: 157.0/255.0, alpha: 1.0).CGColor | |
} else { | |
self.layer.cornerRadius = 0 | |
self.layer.shadowOpacity = 0 | |
self.layer.shadowRadius = 0 | |
self.layer.shadowColor = nil | |
} | |
self.setNeedsLayout() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment