UIImageView Aspect Fill crop to bounds

I have a simple, square UIImageView that I show in my ViewController. The image I want it to display is not a square, but a pronounced rectangle. When I put the image in the UIImageView and set it to Aspect Fill (because I want to see the most of the picture I can while still filling the entire square with it), the image does not contain itself in the square view, but "leak" out. How can I make it so that I can Aspect Fill an Image in a UIImageView while still making the image only visible within the bounds of the view?

Accepted Reply

Tried

.masksToBounds = YES; ...?

Replies

Tried

.masksToBounds = YES; ...?