I have a class to use with @IBInspectable
, to get the properties within my storyboard. Here is a small chunk of it:
/// UIView subclass to allow creating corners, shadows, and borders in storyboards.
final class GEView: UIView {
// MARK: - Rounded corners
@IBInspectable
var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = self.cornerRadius
layer.masksToBounds = true
}
}
/* ... */
}
This works completely fine within UIView
s in my storyboard. However, I want this to also work with UIImageView
s and other subclasses of UIView
. Is this possible without subclassing my GEView
, by somehow making this a generic?