Container Content Margins
Adds the margins of the container the view is in.
Platform Compatibility
iOS 27.1+ iPadOS 27.1+ macOS 27.1+ watchOS 27.1+ visionOS 27.1+
Tags
SwiftUI Code
VStack(spacing: 0) {
Color.blue
Color.indigo
.contentMargins(
for: .container,
edges: .all
)
List {
Text("FooBar")
}
}Found an issue or have a suggestion?
Created: October 15, 2026Updated: October 15, 2026
More View Components
View allToolbar Vertical Edge
This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.
Music Picker
Presents a music picker to select items from the Apple Music catalog and the user’s music library.
Explore Other Components
Browse allMultiple Sources Toggle
Creates a toggle that updates the selected property for all sources. Once toggled, all sources will have the same value.
Button Styles
A type that applies standard interaction behavior and a custom appearance to all buttons within a view hierarchy
WheelPickerStyle
A picker style that presents the options in a scrollable wheel that shows the selected option and a few neighboring options.