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.
201elements
Shapes
ContainerRelativeShape
A shape that is replaced by an inset version of the current container shape. If no container shape was defined, is replaced by a rectangle
Explore ContainerRelativeShape on iPhone in portrait, with SwiftUI code and Apple API documentation.
SwiftUI code
VStack {
Text("Foo")
VStack {
Text("Bar")
Text("Foo")
.padding()
.background(ContainerRelativeShape().fill(Color.green))
}
.padding()
.background(ContainerRelativeShape().fill(Color.red))
}
.padding()
.background(.blue, in: RoundedRectangle(cornerRadius: 40))Compatibility
iOS 14.0+ iPadOS 14.0+ macOS 11.0+ watchOS 7.0+ tvOS 14.0+ visionOS 1.0+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone screenshot for ContainerRelativeShape.