Contents

body

A rectangular view that’s filled with the shape style.

Declaration

var body: _ShapeView<Rectangle, Self> { get }

Discussion

For a ShapeStyle that also conforms to the View protocol, like Color or LinearGradient, this default implementation of the body property provides a visual representation for the shape style. As a result, you can use the shape style in a view hierarchy like any other view:

ZStack {
    Color.cyan
    Text("Hello!")
}
.frame(width: 200, height: 50)

[Image]