offset(_:)
Changes the relative position of this shape using the specified point.
Declaration
func offset(_ offset: CGPoint) -> OffsetShape<Self>Parameters
- offset:
The amount, in points, by which you offset the shape. Negative numbers are to the left and up; positive numbers are to the right and down.
Return Value
A shape offset by the specified amount.
Discussion
The following example renders two circles. It places one circle at its default position. The second circle is outlined with a stroke, positioned on top of the first circle and offset by 100 points to the left and 50 points below.
Circle()
.overlay(
Circle()
.offset(CGPoint(x: -100, y: 50))
.stroke()
)