Instance Method

clipped(antialiased:)

Clips this view to its bounding rectangular frame.

Declaration

func clipped(antialiased: Bool = false) -> some View

Parameters

antialiased

A Boolean value that indicates whether the rendering system applies smoothing to the edges of the clipping rectangle.

Return Value

A view that clips this view to its bounding frame.

Discussion

Use the clipped(antialiased:) modifier to hide any content that extends beyond the layout bounds of the shape.

By default, a view’s bounding frame is used only for layout, so any content that extends beyond the edges of the frame is still visible.

Text("This long text string is clipped")
    .fixedSize()
    .frame(width: 175, height: 100)
    .clipped()
    .border(Color.gray)
Screenshot showing text clipped to its frame.

See Also

Masking and Clipping Views

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

Sets a clipping shape for this view.

func cornerRadius(CGFloat, antialiased: Bool) -> View

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

func mask<Mask>(Mask) -> View

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