Instance Method


Clips the view to its bounding frame, with the specified corner radius.


func cornerRadius(_ radius: CGFloat, antialiased: Bool = true) -> some View



A Boolean value that indicates whether smoothing is applied to the edges of the clipping rectangle.

Return Value

A view that clips this view to its bounding frame.


By default, a view’s bounding frame only affects its layout, so any content that extends beyond the edges of the frame remains visible. Use the cornerRadius(_:antialiased:) modifier to hide any content that extends beyond these edges while applying a corner radius.

The following code applies a corner radius of 20 to a square image:

Text("Rounded Corners")
    .frame(width: 175, height: 75)

See Also

Masking and Clipping Views

func clipped(antialiased: Bool) -> View

Clips the view to its bounding rectangular frame.

func clipShape<S>(S, style: FillStyle) -> View

Sets a clipping shape for the view.

func mask<Mask>(Mask) -> View

Masks this view using the alpha channel of the given view.