clipped

Clips this view to its bounding rectangular frame.

View ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+clipped(antialiased:) in SwiftUI

Declaration

React
compose().clipped({
  antialiased?: boolean,
})
Swift
nonisolated func clipped(antialiased: Bool = false) -> some View

Parameters

  • options.antialiasedboolean

    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)

See also

More in Visual effects.