Last active
November 17, 2016 10:39
-
-
Save michaelevensen/7bdcc5bad7d557a4db16195b4083b4bb to your computer and use it in GitHub Desktop.
Simple IBDesignable template for a UIView with customizable cornerRadius, strokeWidth and strokeColor.
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
@IBDesignable | |
class RoundedView: UIView { | |
@IBInspectable var roundedValue: CGFloat = 0.0 { | |
didSet { | |
layer.cornerRadius = roundedValue | |
} | |
} | |
@IBInspectable var strokeWidth: CGFloat = 0.0 { | |
didSet { | |
layer.borderWidth = strokeWidth | |
} | |
} | |
@IBInspectable var strokeColor: UIColor = UIColor.clear { | |
didSet { | |
layer.borderWidth = strokeWidth | |
layer.borderColor = strokeColor.cgColor | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment