To the frame of the UIImageView coincide with the image size, you need to get the dimensions of the UIImage. In practice, have aspect ratio ofUIImage, and resinite frame with this ratio.
Now the picture will always be inscribed in the frame.
Think about it logically, to fit the frame under the picture, not the picture under the frame if you use .scaleAspectFit.
Rounds the corners of the
Now that the frame has the same dimensions as the image, rounding the corners will work. The problem is solved.
Depends on the method. If you activate the mask, the shadows will not be visible. Make a container in which is placed a UIImageView, for it put the mask. And the shadow put the container.