<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ShapeView",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI9ShapeViewP"
  },
  "title" : "ShapeView"
}
-->

# ShapeView

A view that provides a shape that you can use for drawing operations.

```
nonisolated protocol ShapeView<Content> : View
```

## Overview

Use this type with the drawing methods on [`Shape`](/documentation/SwiftUI/Shape) to apply multiple fills
and/or strokes to a shape. For example, the following code applies a fill
and stroke to a capsule shape:

```
Capsule()
    .fill(.yellow)
    .stroke(.blue, lineWidth: 8)
```

## Topics

### Getting the shape

[`var shape: Self.Content`](/documentation/SwiftUI/ShapeView/shape)

The shape that this type draws and provides for other drawing
operations.

[`associatedtype Content : Shape`](/documentation/SwiftUI/ShapeView/Content)

The type of shape this can provide.

### Modify the shape

[`func fill<S>(S, style: FillStyle) -> FillShapeView<Self.Content, S, Self>`](/documentation/SwiftUI/ShapeView/fill(_:style:))

Fills this shape with a color or gradient.

[`func stroke<S>(S, style: StrokeStyle, antialiased: Bool) -> StrokeShapeView<Self.Content, S, Self>`](/documentation/SwiftUI/ShapeView/stroke(_:style:antialiased:))

Traces the outline of this shape with a color or gradient.

[`func stroke<S>(S, lineWidth: CGFloat, antialiased: Bool) -> StrokeShapeView<Self.Content, S, Self>`](/documentation/SwiftUI/ShapeView/stroke(_:lineWidth:antialiased:))

Traces the outline of this shape with a color or gradient.

[`func strokeBorder<S>(S, style: StrokeStyle, antialiased: Bool) -> StrokeBorderShapeView<Self.Content, S, Self>`](/documentation/SwiftUI/ShapeView/strokeBorder(_:style:antialiased:))

Returns a view that’s the result of insetting this view by half of its style’s line width.

[`func strokeBorder<S>(S, lineWidth: CGFloat, antialiased: Bool) -> StrokeBorderShapeView<Self.Content, S, Self>`](/documentation/SwiftUI/ShapeView/strokeBorder(_:lineWidth:antialiased:))

Returns a view that’s the result of filling an inner stroke of this view with the content you supply.

## Relationships

### Conforming Types

[`FillShapeView`](/documentation/SwiftUI/FillShapeView)

[`StrokeShapeView`](/documentation/SwiftUI/StrokeShapeView)

[`StrokeBorderShapeView`](/documentation/SwiftUI/StrokeBorderShapeView)

### Inherits From

[`View`](/documentation/SwiftUI/View)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)