AnyView

public struct AnyView : View, CustomMappable

A type-erased View.

An AnyView allows changing the type of view used in a given view hierarchy.

  • The Never type indicates that this view doesn’t define its subviews via the body property.

    Declaration

    Swift

    public typealias Body = Never
  • The implementation of this method delegates to the content view.

    Declaration

    Swift

    public func html(forHTMLOfSubnodes htmlOfSubnodes: [HTMLNode]) -> HTMLNode
  • Instantiates an AnyView by wrapping content.

    Declaration

    Swift

    public init<Content>(content: Content) where Content : View
  • Instantiates an AnyView by wrapping content.

    Declaration

    Swift

    public init(content: TypeErasedView)
  • Declaration

    Swift

    public func customMap<T>(_ transform: (TypeErasedView) -> T) -> [T]