title: How to set UIImageView with rounded corners for aspect fit mode
body: <p>I usually use the following code to set rounded corners.</p>
  
  <pre><code>imageView.layer.cornerRadius = 10
  </code></pre>
  
  <p>It works when the imageView is set at Aspect Fill.</p>
  
  <p>But when the imageView is set to Aspect Fit mode, and the ratio between imageView and picture are different.
  The rounded corners effect won't be able to tell.</p>
  
  <p><a href="https://i.stack.imgur.com/MnKcI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/MnKcI.jpg" alt="enter image description here"></a></p>
  
  <p>The background color is set to green for showing the rounded corners.</p>
  
  <p>Is there any way to set 'real image part' to rounded corners.</p>
  
  <p>Thank you in advance for your answers.</p>