M13Checkbox
M13Checkbox copied to clipboard
Ambiguous use of 'cornerRadius'
I am sub-classing M13CheckBox
init(title:String) {
super.init(frame: CGRect())
self.boxType = .square
self.markType = .checkmark
self.backgroundColor = UIConstants.buttonBorderColor
self.cornerRadius = 3
}
but I have the following error on self.cornerRadius = 3 line - Ambiguous use of 'cornerRadius'
It goes away if I user (self as UIView).cornerRadius = 3 but still its worth mentioning
cornerRadius is a property of CALayer. This is why it's ambigus.
I'm getting the same error, and it goes away with the workaround above but it doesn't apply the cornerRadius
property properly as when you apply it via inspector. The underlying code is not being called:
@IBInspectable open var cornerRadius: CGFloat {
get {
return controller.pathGenerator.cornerRadius
}
set {
controller.pathGenerator.cornerRadius = newValue
setNeedsLayout()
}
}
How can I fix the Ambiguous use of 'cornerRadius'
error when not using storyboards?