This i my code:
Image()
.resizable()
.scaledToFill()
.frame(width: 200, height: 200)
.clipShape(Rectangle().cornerRadius(8).rotationEffect(.degrees(45)))
I receive this error:
Instance method ‘clipShape(_:style:)’ requires that ‘some View’ conform to ‘Shape’
Or you know another way to crop my image to diamond?
2
Answers
Try to use mask instead, maybe it will be enough for your needs, and it accepts views, like
Like this?
You can encapsulate the image in a ZStack and rotate them opposite to each other. Then set the frame of the ZStack to match the image. Feel free to ask if anything is unclear!