SwiftUI Image View: ClipShape
We are not limited to clip image content to a frame rectangle but with the help of .clipShape() modifier, we can clip image to a given shape.
In order to visualize this better, we will apply dark appearance modifier to previewProvider
struct ImageExample: View {
var body: some View {
Image("dt")
.frame(width: 200, height: 200)
.clipShape(Circle())
}
}struct ImageExample_Previews: PreviewProvider {
static var previews: some View {
ImageExample()
.preferredColorScheme(.dark)
}
}