<!--
{
  "availability" : [
    "iOS: 27.1.0 -",
    "iPadOS: 27.1.0 -",
    "macCatalyst: 27.1.0 -",
    "macOS: 27.1.0 -",
    "tvOS: 27.1.0 -",
    "visionOS: 27.1.0 -",
    "watchOS: 27.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/GeometryProxy/contentMargins(for:edges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13GeometryProxyV14contentMargins3for5edgesAA10EdgeInsetsVAA18ContentMarginGuideV_AA0I0O3SetVtF"
  },
  "title" : "contentMargins(for:edges:)"
}
-->

# contentMargins(for:edges:)

The insets of a content margin guide for the given edges.

```
func contentMargins(for guide: ContentMarginGuide, edges: Edge.Set = .all) -> EdgeInsets
```

## Parameters

`guide`

The guide that provides the insets.

`edges`

The edges to read insets for.

## Return Value

The insets `guide` provides for `edges`. Edges not in the
set have a value of zero.

## Discussion

Read a guide when you need its value rather than the inset, like a
view that draws its own content:

```
GeometryReader { proxy in
    Canvas { context, size in
        drawChart(
            in: context, size: size,
            insets: proxy.contentMargins(for: .container, edges: .horizontal))
    }
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)