iPhone Duo SwiftUI examples

Explore SwiftUI APIs, components, and modifiers on iPhone Duo. Compare portrait and landscape layouts in closed, partially open, and fully open states, with Swift code and Apple documentation.

View

Container Content Margins

Adds the margins of the container the view is in.

Explore Container Content Margins on iPhone Duo in portrait and landscape across closed, partially open, and fully open states, with SwiftUI code and Apple API documentation.

VStack(spacing: 0) {
    Color.blue
    Color.indigo
        .contentMargins(
            for: .container,
            edges: .all
        )
    List {
        Text("FooBar")
    }
}
iOS 27.1+ iPadOS 27.1+ macOS 27.1+ watchOS 27.1+ visionOS 27.1+

Every available iPhone Duo screenshot for Container Content Margins.

6 views