iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

ConcentricRectangle

Concentric Rectangle

A concentric rectangle whose corner radii are defined from the same circle center as its parent element. The outermost parent is the device frame.

Explore Concentric Rectangle on iPhone in portrait, with SwiftUI code and Apple API documentation.

ZStack(alignment: .bottom) {
    // Respects radius from devide frame
    ConcentricRectangle()
        .fill(Color.blue)
        .frame(height: 50)
        .frame(maxHeight: .infinity, alignment: .bottom)
        .padding(30)
        .ignoresSafeArea()

    ZStack {
        // Gets radius from parent rect
        ConcentricRectangle()
            .fill(.secondary)

        // Respects radius from parent rect
        ConcentricRectangle()
            .fill(.red)
            .frame(width: 200, height: 200)
            .padding([.trailing, .bottom])
    }
    .containerShape(
            .rect(cornerRadius: 42)
    )
    .frame(width: 250, height: 250)
    .padding(.bottom)
}
iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ tvOS 26.0+ visionOS 26.0+

Every available iPhone screenshot for Concentric Rectangle.

1 views