[SwiftUI] Adjusting non-square images to square(1:1) with clipShape

<p>You might include images directly in your assets or fetch them from servers. If every image maintained a 1:1 ratio, life would be simple. Yet, most images in our albums are rectangular, having diverse width-to-height ratios.</p> <p>Let me give you an example: a photo from my trip to Dumbo, NY. It&rsquo;s vertically oriented &mdash; taller than its width.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:678/1*h7Kp00lWLN6ktcO0SA9Cpw.png" style="height:272px; width:616px" /></p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:744/1*ngCXbk3C8OKfx3IbKvuL0g.png" style="height:540px; width:356px" /></p> <p>It seems fine, right? the image seems perfectly clipped into a circle. However, if you add a red border, you can see the hidden frame.</p> <p><a href="https://medium.com/@Jager-yoo/swiftui-adjusting-non-square-images-to-square-1-1-with-clipshape-9e2ab811663f"><strong>Click Here</strong></a></p>
Tags: Images Square