<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/containerCornerOffset(_:sizeToFit:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE21containerCornerOffset_9sizeToFitQrAA4EdgeO3SetV_SbtF"
  },
  "title" : "containerCornerOffset(_:sizeToFit:)"
}
-->

# containerCornerOffset(_:sizeToFit:)

Adjusts the view’s layout to avoid the container view’s corner insets
for the specified edges.

```
nonisolated func containerCornerOffset(_ edges: Edge.Set, sizeToFit: Bool = false) -> some View
```

## Parameters

`edges`

The set of edges which the container view should add corner
insets from.

`sizeToFit`

A flag indicating when this view is offset off a
corner inset whether its size should attempt to fit into its
remaining space of the view or fill its original size.

## Discussion

Use this modifier when you would like the view’s layout to adapt to
avoid the container view’s corner insets for a set of edges. Corner
insets may include pieces of system UI as well as the corner radii for
windows and presentations. When a specific edge is provided the view is
positioned to avoid insets from only the corners of that edge. When
multiple corner edges overlap in the same axis the view will be
positioned off the larger overlapping inset.

```
DrawingCanvasView(canvas: $canvas)
    .ignoresSafeArea()
    .overlay(alignment: .topLeading) {
        DrawingToolPaletteView(tool: $selectedTool)
            .containerCornerOffset(.horizontal)
    }
```

The modifier provides a `sizeToFit` parameter to indicate how the
view should be sized when it has been offset from a corner inset.
By default, `false` is provided, and the content’s size will
be unchanged, only the position of the view’s content will be offset.
When `true`, the content will attempt to size itself with a proposal
using the remaining size of the original view subtracted from the
overlapping corner insets.

---

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)