Greetings, traveler!
In interface design, consistent corner radii help reinforce structure and spatial relationships. When one container nests within another, the inner view’s corner radius should visually correspond to the outer radius minus the padding. This ratio-based adjustment ensures that the nested shape appears as part of the same rounded surface rather than a separate visual element.
Previously, achieving this required manual calculations or shape composition. With iOS 26, Apple introduces APIs that solve this layout challenge automatically.
ConcentricRectangle and .containerShape
iOS 26 brings two interrelated APIs: ConcentricRectangle, a new shape type, and the .containerShape modifier, which defines the reference shape and radius used for internal layout calculations.
ConcentricRectangle calculates its corner radius based on its container’s shape, taking into account the distance (e.g., padding) from the container’s edge. .containerShape communicates the outer boundary that inner elements should align with.
Using
ConcentricRectangle as a Shape View
The simplest use case involves rendering a ConcentricRectangle directly as a visual element. The inner rectangle automatically computes its corner rounding from the outer rectangle and spacing:
import SwiftUI
struct DemoView: View {
var body: some View {
VStack {
ZStack {
ConcentricRectangle()
.fill(.black)
ConcentricRectangle()
.fill(.blue)
.padding(22)
}
.frame(height: 350)
.containerShape(.rect(cornerRadius: 33))
}
.padding()
}
}
Using .clipShape(.rect(…)) with .concentric Corners
The same system applies even when using standard SwiftUI shapes. You can clip views using .rect(corners: .concentric) to achieve the same proportional rounding behavior.
import SwiftUI
struct DemoView: View {
var body: some View {
VStack {
ZStack {
Rectangle()
.fill(.black)
.clipShape(.rect(corners: .concentric(), isUniform: true))
Rectangle()
.fill(.blue)
.clipShape(.rect(corners: .concentric(), isUniform: true))
.padding(22)
}
.frame(height: 350)
.containerShape(.rect(cornerRadius: 33))
}
.padding()
}
}
The isUniform parameter lets you choose whether the concentric rounding applies equally to all corners or only to the areas actually influenced by the container’s shape. This distinction becomes relevant in layouts where only some corners are visually affected—for instance, when aligning content to the bottom of the screen.
Device-Aware Corner Adaptation
A distinguishing feature of ConcentricRectangle is that it respects not only the shape defined by its parent view, but also the physical display shape of the device itself. When extending content to the screen edges (e.g., using .ignoresSafeArea()), concentric shapes will match the visible curvature of the hardware—such as the rounded corners of an iPhone or iPad.
import SwiftUI
struct DemoView: View {
var body: some View {
VStack {
Spacer()
Rectangle()
.fill(.blue.gradient)
.frame(height: 400)
.clipShape(.rect(corners: .concentric, isUniform: true))
.padding(12)
.ignoresSafeArea()
}
}
}
Behavior in Full-Screen Contexts
When applying a concentric corner clip to a FullScreenCover, the shape automatically inherits the system-defined container corner geometry. Since full-screen containers don’t define their own .containerShape by default, the system falls back to the physical device’s corners. As a result, concentric clips applied to such views will match the surrounding interface without requiring any additional configuration.
If you enjoyed this article, please feel free to follow me on my social media: