M13Checkbox icon indicating copy to clipboard operation
M13Checkbox copied to clipboard

Ambiguous use of 'cornerRadius'

Open kamendo opened this issue 4 years ago • 2 comments

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

kamendo avatar Jun 11 '20 09:06 kamendo

cornerRadius is a property of CALayer. This is why it's ambigus.

iDevelopper avatar Mar 02 '21 16:03 iDevelopper

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?

alexeystrakh avatar Jul 11 '23 23:07 alexeystrakh