Tokamak icon indicating copy to clipboard operation
Tokamak copied to clipboard

Offset support

Open j-f1 opened this issue 5 years ago • 0 comments

public func offset(_ offset: CGSize) -> some View
public func offset(x: CGFloat = 0, y: CGFloat = 0) -> some View

Offset this view by the horizontal and vertical amount specified in the offset parameter.

Use offset(_:) to to shift the displayed contents by the amount specified in the offset parameter.

Use offset(x:y:) to to shift the displayed contents by the amount specified in the x and y parameters.

The original dimensions of the view aren't changed by offsetting the contents; in the example below the gray border drawn by this view surrounds the original position of the text:

Text("Offset by passing CGSize()")
    .border(Color.green)
    .offset(CGSize(width: 20, height: 25))
    .border(Color.gray)

j-f1 avatar Dec 05 '20 22:12 j-f1