When I set corner radius with constant value, depending on the size of the image, the results don't come out the way I want.
Image(“myImage”)
.cornerRadius(25)
What I want in app.
More clipped in Widget
So I want to set radius value like
image.size.height / 5
, depending on its own size.
When I think about overlay, code will be like below,
Image("myImage")
.overlay(
GeometryReader { geo in
RoundedRectangle(cornerRadius: geo.size.height / 5)
}
)
but when it comes to clipShape to apply corner radius, I don't know how to do.
Try using clip shape with Circle as shape - Using it with an aspect ratio will give you a perfectly square image and content mode will make sure the image fits perfectly.
Use something like this -