Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IBInspectable example for MLSDev blog articles
extension UIView {
@IBInspectable var cornerRadius: CGFloat {
get { return layer.cornerRadius }
set {
layer.cornerRadius = newValue
layer.masksToBounds = newValue > 0
}
}
@IBInspectable var borderWidth: CGFloat {
get { return layer.borderWidth }
set { layer.borderWidth = newValue }
}
@IBInspectable var borderColor : UIColor {
get { return UIColor(CGColor: layer.borderColor ?? UIColor.whiteColor().CGColor }
set { layer.borderColor = newValue.CGColor }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment