size(width:height:anchor:)
Returns a new version of self representing the same shape, but within a rect of (width, height) instead of the container size.
Declaration
nonisolated func size(width: CGFloat, height: CGFloat, anchor: UnitPoint) -> some Shape
Parameters
- width:
The width to constrain the shape to.
- height:
The height to constrain the shape to.
- anchor:
The anchor to use to determine how to position the new shape.
Return Value
A new shape constrained to the given size, and positioned using anchor.
Discussion
The anchor parameter determines how the shape will be positioned within the container when the path’s bounds and the container’s bounds are not equal. This does not affect the layout properties of any views created from the shape (e.g. by filling it).