Skip to content

Instantly share code, notes, and snippets.

@Anatoli-Petrosyants
Created February 1, 2018 07:47
Show Gist options
  • Save Anatoli-Petrosyants/798dc2f894c5be3db248150769eecadb to your computer and use it in GitHub Desktop.
Save Anatoli-Petrosyants/798dc2f894c5be3db248150769eecadb to your computer and use it in GitHub Desktop.
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 = newValue
}
}
@IBInspectable var borderColor: UIColor? {
get {
return UIColor(cgColor: layer.borderColor!)
}
set {
layer.borderColor = newValue?.cgColor
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment