While we want to set uiview property (like CornerRadius, borderWidth, borderColor, roundCorners, shadowColor, shadowOpacity, shadowOffset, shadowRadius) at that time we use code or user defined runtime attribute for that but using this extension we can esily update property from attribute inspector.
code support SWIFT 3.0
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 { if let color = layer.borderColor { return UIColor(cgColor: color) } return nil } set(newValue) { layer.borderColor = newValue?.cgColor } } func roundCorners(corners:UIRectCorner, radius: CGFloat) { let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius)) let mask = CAShapeLayer() mask.path = path.cgPath self.layer.mask = mask } /// The color of the shadow. Defaults to opaque black. Colors created from patterns are currently NOT supported. Animatable. @IBInspectable var shadowColor: UIColor? { get { return UIColor(cgColor: self.layer.shadowColor!) } set { self.layer.shadowColor = newValue?.cgColor } } /// The opacity of the shadow. Defaults to 0. Specifying a value outside the [0,1] range will give undefined results. Animatable. @IBInspectable var shadowOpacity: Float { get { return self.layer.shadowOpacity } set { self.layer.shadowOpacity = newValue } } /// The shadow offset. Defaults to (0, -3). Animatable. @IBInspectable var shadowOffset: CGSize { get { return self.layer.shadowOffset } set { self.layer.shadowOffset = newValue } } /// The blur radius used to create the shadow. Defaults to 3. Animatable. @IBInspectable var shadowRadius: Double { get { return Double(self.layer.shadowRadius) } set { self.layer.shadowRadius = CGFloat(newValue) } } }