I am trying to extend the UIButton class by adding a cornerRadius property which can be changed at the design time without having to build the app. I am using the following extension class:
import UIKit
@IBDesignable
extension UIButton {
@IBInspectable var cornerRadius :CGFloat {
get {
return layer.cornerRadius
}
set {
layer.cornerRadius = newValue
layer.masksToBounds = newValue > 0
}
}
}
But when I make a change of the property cornerRadius in the Storyboard I do not see the change happening live! Am I missing something!
Extensions don't honor the IBDesignable qualifier. Only actual subclasses do. Annoying but true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With