One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

RoundedRectangle

struct · iOS 13.0+ · SDK 27.1

@frozen struct RoundedRectangle

A rectangular shape with rounded corners, aligned inside the frame of the view containing it.

Members (11)

init · iOS 13.0+

init

TypeScript
static initCornerSizeStyle(cornerSize: { width: number; height: number }, style?: RoundedCornerStyle): RoundedRectangle
Swift declaration
init(cornerSize: CGSize, style: RoundedCornerStyle = .continuous)

Creates a new rounded rectangle shape. - Parameters: - cornerSize: the width and height of the rounded corners. - style: the style of corners drawn by the shape.

get · iOS 13.0+

cornerSize

TypeScript
get cornerSize(): { width: number; height: number }
Swift declaration
var cornerSize: CGSize

The width and height of the rounded rectangle's corners.

set · iOS 13.0+

cornerSize

TypeScript
set cornerSize(value: { width: number; height: number })
Swift declaration
var cornerSize: CGSize

The width and height of the rounded rectangle's corners.

init · iOS 13.0+

init

TypeScript
static initCornerRadiusStyle(cornerRadius: number, style?: RoundedCornerStyle): RoundedRectangle
Swift declaration
init(cornerRadius: CGFloat, style: RoundedCornerStyle = .continuous)

Creates a new rounded rectangle shape. - Parameters: - cornerRadius: the radius of the rounded corners. - style: the style of corners drawn by the shape.

get · iOS 13.0+

animatableData

TypeScript
get animatableData(): AnimatablePair<number, number>
Swift declaration
nonisolated var animatableData: CGSize.AnimatableData { get set }

The data to animate.

set · iOS 13.0+

animatableData

TypeScript
set animatableData(value: AnimatablePair<number, number>)
Swift declaration
nonisolated var animatableData: CGSize.AnimatableData { get set }

The data to animate.

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.

method · iOS 13.0+

path

TypeScript
path(rect: { x: number; y: number; width: number; height: number }): Path
Swift declaration
nonisolated func path(in rect: CGRect) -> Path

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

The style of corners drawn by the rounded rectangle.

set · iOS 13.0+

style

TypeScript
set style(value: RoundedCornerStyle)
Swift declaration
var style: RoundedCornerStyle

The style of corners drawn by the rounded rectangle.

method · iOS 26.0+

corners

TypeScript
corners(size?: ({ width: number; height: number }) | null): (RoundedRectangularShapeCorners) | null
Swift declaration
func corners(in size: CGSize?) -> RoundedRectangle.Corners?

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.

RoundedRectangle.inset(by:)

This protocol needs associated types that cannot yet cross the bridge.

All SwiftUICore types →