contentMargins(for:edges:)
The insets of a content margin guide for the given edges.
Declaration
func contentMargins(for guide: ContentMarginGuide, edges: Edge.Set = .all) -> EdgeInsetsParameters
- 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))
}
}