How to display Round Image in SwiftUI?

SwiftUI – Round Image

To display a round image in Image view, use clipShape() modifier and pass Circle() shape.

Example

In this example, we shall display an image from assets in an Image views. We shall clip this image in Circular shape using clipShape() modifier.

ContentView.swift

import SwiftUI

struct ContentView: View {
    var body: some View {
        Image("sunrise")
            .resizable()
            .aspectRatio(contentMode: .fit)
            .clipShape(Circle())
    }
}

Screenshot

Display Round Image in SwiftUI
Rounded Image in SwiftUI

Summary

Summarising thisĀ SwiftUI Tutorial, we learned how to display a rounded Image in SwiftUI.