Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous use of 'cornerRadius' #150

Open
kamendo opened this issue Jun 11, 2020 · 2 comments
Open

Ambiguous use of 'cornerRadius' #150

kamendo opened this issue Jun 11, 2020 · 2 comments

Comments

@kamendo
Copy link

kamendo commented Jun 11, 2020

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

@iDevelopper
Copy link
Contributor

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

@alexeystrakh
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants