Link Search Menu Expand Document

AnyView

A type-erased view.

@frozen
public struct AnyView: View 

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.

Inheritance

View

Nested Type Aliases

Body

public typealias Body = Never

Initializers

init(_:)

Create an instance that type-erases view.

public init<ViewType: View>(_ view: ViewType) 

init(erasing:)

@_alwaysEmitIntoClient
  public init<ViewType: View>(erasing view: ViewType)