---
title: AnyShape
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/anyshape
---

# AnyShape

A type-erased shape value.

## Declaration

```swift
@frozen struct AnyShape
```

## Overview

Overview You can use this type to dynamically switch between shape types: struct MyClippedView: View {     var isCircular: Bool

var body: some View {         OtherView().clipShape(isCircular ?             AnyShape(Circle()) : AnyShape(Capsule()))     } }

## Topics

### Creating a shape

- [init(_:)](swiftui/anyshape/init(_:).md)

## Relationships

### Conforms To

- [Animatable](swiftui/animatable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Shape](swiftui/shape.md)
- [View](swiftui/view.md)

## See Also

### Defining shape behavior

- [ShapeView](swiftui/shapeview.md)
- [Shape](swiftui/shape.md)
- [ShapeRole](swiftui/shaperole.md)
- [StrokeStyle](swiftui/strokestyle.md)
- [StrokeShapeView](swiftui/strokeshapeview.md)
- [StrokeBorderShapeView](swiftui/strokebordershapeview.md)
- [FillStyle](swiftui/fillstyle.md)
- [FillShapeView](swiftui/fillshapeview.md)
