SwiftUI Image clipsToBounds
Image("large")
.resizable()
.clipShape(Circle())
.frame(width: 200.0, height: 200.0)
.overlay(Circle().stroke(Color.white,lineWidth:4).shadow(radius: 10))
You can use the .clipped()
modifier, which results in an effect similar to UIView.clipsToBounds
:
Image("large")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 80, height: 80, alignment: .center)
.border(Color.black)
.clipped() // Equal to clipsToBounds = true