Contents

AnyShape

A type-erased shape value.

Declaration

@frozen struct AnyShape

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

See Also

Defining shape behavior