SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.24k stars 742 forks source link

not able to set cornerRadius #417

Closed annathomasQB closed 3 years ago

annathomasQB commented 3 years ago

Hi, First of all, superb library! 👍

I'm using custom xib to show the swift messages. By looking in the Readme, I'm trying to set the cornerRadius of the view, but it throws the error "Ambiguous use of cornerRadius".

So I tried setting view.layer.cornerRadius. But it doesn't change anything to the final view. I tried really large values to see any difference in cornerRadius but nothing.

Can you help me out ?

What I tried :

if let view = alertView.backgroundView as? CornerRoundingView {
                view.cornerRadius = 150    // setting a huge value just to see if any visible change 
            }

The above code throws the error.

Screenshot 2020-09-21 at 4 10 41 PM

What doesn't throw error (but sadly doesn't work as well)


           if let view = alertView.backgroundView as? CornerRoundingView {
                view.layer.cornerRadius = 150
            }
annathomasQB commented 3 years ago

Hi

Was able to resolve this by changing the corner Radius in the xib file for background view.. :)

So cheers!! :) Closing this issue.

wtmoose commented 3 years ago

Hmm. I don't know where that error comes from. I guess its something specific to your project. If you expand the error, I think it will point out where the ambiguous property definitions are.

CornerRoundingView was introduced for continuous rounded corners before Apple supported it directly through the layer.cornerCurve property. CornerRoundingView isn't strictly needed anymore.

Anyway, glad you got it fixed.

annathomasQB commented 3 years ago

oh, thanks for that info! 👍

cliftonlabrum commented 3 years ago

@wtmoose I see this same error. Is cornerRadius supposed to be a changeable property?

image

wtmoose commented 3 years ago

@cliftonlabrum yes

nichita-stefanita commented 3 years ago

Have the same issue. @cliftonlabrum were you able to solve it?

cliftonlabrum commented 3 years ago

No, I never found a fix.

nichita-stefanita commented 3 years ago

@wtmoose any idea why this error is happening and how to solve it ? Maybe there is a workaround or another way to disable/modify cornerRadius ? Would apreciate some help here

wtmoose commented 3 years ago

@nichita-stefanita no idea whatsoever. It's not normal. Send me a sample project and I'll take a look.