clipShape
モディファイアでViewを切り取ることができます。切り取ることができる形状は以下のとおりです。
形状 | |
---|---|
四角形 | Rectangle() |
角丸の四角形 | RoundedRectangle() |
カプセル形 | Capsule() |
円形 | Circle() |
楕円形 | Ellipse() |
var body: some View {
Image("Red")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 50, height: 50, alignment: .center)
.clipShape(Circle())
}
