A capsule shape aligned inside the frame of the view containing it.
A capsule shape is equivalent to a rounded rectangle where the corner radius
is chosen as half the length of the rectangle's smallest edge.
Members (6)
get · iOS 17.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 13.0+
style
TypeScript
get style(): RoundedCornerStyle
Swift declaration
var style: RoundedCornerStyle
set · iOS 13.0+
style
TypeScript
set style(value: RoundedCornerStyle)
Swift declaration
var style: RoundedCornerStyle
init · iOS 13.0+
init
TypeScript
static init(style?: RoundedCornerStyle): Capsule
Swift declaration
init(style: RoundedCornerStyle = .continuous)
Creates a new capsule shape.
- Parameters:
- style: the style of corners drawn by the shape.
Resolved corners given a size. If the corner style of a shape is
size-dependent, read the provided size and return values accordingly.
This function could be called with a nil size when the size hasn't been
determined. In that case, return the best approximated value.
For example, for a capsule shape, its corner radius is determined by the
size. If size is not available, return `.fixed(.infinity)` to indicate
that the corner should be as round as it could be.
Skipped declarations
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
Capsule.inset(by:)
This protocol needs associated types that cannot yet cross the bridge.