---
title: AnyView
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/anyview
---

# AnyView

A type-erased view.

## Declaration

```swift
@frozen nonisolated struct AnyView
```

## Overview

Overview An AnyView allows changing the type of view used in a given view hierarchy. Whenever the type of view used with an AnyView changes, the old hierarchy is destroyed and a new hierarchy is created for the new type.

## Topics

### Creating a view

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

## Relationships

### Conforms To

- [View](swiftui/view.md)

## See Also

### Supporting view types

- [EmptyView](swiftui/emptyview.md)
- [EquatableView](swiftui/equatableview.md)
- [SubscriptionView](swiftui/subscriptionview.md)
- [TupleView](swiftui/tupleview.md)
