The default shape applied by glass effects, a capsule.
You do not use this type directly. Instead, SwiftUI creates this
shape on your behalf as the default parameter of the
``View/glassEffect(_:in:)`` modifier.
Members (5)
method · iOS 26.0+
sizeThatFits
TypeScript
sizeThatFits(proposal: ProposedViewSize): { width: number; height: number }
Returns the size of the view that will render the shape, given
a proposed size.
Implement this method to tell the container of the shape how
much space the shape needs to render itself, given a size
proposal.
See ``Layout/sizeThatFits(proposal:subviews:cache:)``
for more details about how the layout system chooses the size of
views.
- Parameters:
- proposal: A size proposal for the container.
- Returns: A size that indicates how much space the shape needs.
get · iOS 26.0+
layoutDirectionBehavior
TypeScript
get layoutDirectionBehavior(): LayoutDirectionBehavior
Swift declaration
nonisolated var layoutDirectionBehavior: LayoutDirectionBehavior { get }
Returns the behavior this shape should use for different layout
directions.
If the layoutDirectionBehavior for a Shape is one that mirrors, the
shape's path will be mirrored horizontally when in the specified layout
direction. When mirrored, the individual points of the path will be
transformed.
Defaults to `.mirrors` when deploying on iOS 17.0, macOS 14.0,
tvOS 17.0, watchOS 10.0 and later, and to `.fixed` if not.
To mirror a path when deploying to earlier releases, either use
`View.flipsForRightToLeftLayoutDirection` for a filled or stroked
shape or conditionally mirror the points in the path of the shape.
Describes this shape as a path within a rectangular frame of reference.
- Parameter rect: The frame of reference for describing this shape.
- Returns: A path that describes this shape.
get · iOS 26.0+
role
TypeScript
static get role(): ShapeRole
Swift declaration
nonisolated static var role: ShapeRole { get }
An indication of how to style a shape.
SwiftUI looks at a shape's role when deciding how to apply a
``ShapeStyle`` at render time. The ``Shape`` protocol provides a
default implementation with a value of ``ShapeRole/fill``. If you
create a composite shape, you can provide an override of this property
to return another value, if appropriate.