containerCornerOffset
Adjusts the view's layout to avoid the container view's corner insets for the specified edges.
Declaration
compose().containerCornerOffset(
edges: SwiftUI.EdgeSet,
options?: {
sizeToFit?: boolean;
}
)nonisolated func containerCornerOffset(
_ edges: Edge.Set,
sizeToFit: Bool = false
) -> some ViewParameters
edges*SwiftUI.EdgeSetThe set of edges which the container view should add corner insets from.
options.sizeToFitbooleanA 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.
See also
More in Layout.
- alignmentGuideSets the view's vertical alignment.
- aspectRatioConstrains this view's dimensions to the specified aspect ratio.
- containerRelativeFramePositions this view within an invisible frame with a size relative to the nearest container.
- controlSizeSets the size for controls within this view.
- defaultScrollAnchorAssociates an anchor to control which part of the scroll view's content should be rendered by default.
- dynamicTypeSizeSets the Dynamic Type size within the view to the given value.
- fixedSizeFixes this view at its ideal size.
- flipsForRightToLeftLayoutDirectionSets whether this view mirrors its contents horizontally when the layout direction is right-to-left.
- framePositions this view within an invisible frame.
- geometryGroupIsolates the geometry (e.g. position and size) of the view from its parent view.
- gridCellAnchorSpecifies a custom alignment anchor for a view that acts as a grid cell.
- gridCellColumnsTells a view that acts as a cell in a grid to span the specified number of columns.