Skip to content

Instantly share code, notes, and snippets.

@Alexander-Ignition
Created July 11, 2015 08:39
Show Gist options
  • Save Alexander-Ignition/1b2b75261d9b33e730d1 to your computer and use it in GitHub Desktop.
Save Alexander-Ignition/1b2b75261d9b33e730d1 to your computer and use it in GitHub Desktop.
RoundedView
import UIKit
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 = borderWidth
}
}
@IBInspectable var borderColor: UIColor? {
get {
return UIColor(CGColor: layer.borderColor)
}
set {
layer.borderColor = self.borderColor?.CGColor
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment