---
title: "CGRectOffset(_:_:_:)"
framework: coregraphics
role: symbol
role_heading: Function
path: "coregraphics/cgrectoffset(_:_:_:)"
---

# CGRectOffset(_:_:_:)

Returns a rectangle with an origin that is offset from that of the source rectangle.

## Declaration

```swift
func CGRectOffset(_ rect: CGRect, _ dx: CGFloat, _ dy: CGFloat) -> CGRect
```

## Parameters

- `rect`: The source rectangle.
- `dx`: The offset value for the x-coordinate.
- `dy`: The offset value for the y-coordinate.

## Return Value

Return Value A rectangle that is the same size as the source, but with its origin offset by dx units along the x-axis and dy units along the y-axis with respect to the source. Returns a null rectangle if rect is a null rectangle.

## See Also

### Modifying Rectangles

- [CGRectInset(_:_:_:)](coregraphics/cgrectinset(_:_:_:).md)
- [CGRectIntegral(_:)](coregraphics/cgrectintegral(_:).md)
- [CGRectIntersection(_:_:)](coregraphics/cgrectintersection(_:_:).md)
- [CGRectStandardize(_:)](coregraphics/cgrectstandardize(_:).md)
- [CGRectUnion(_:_:)](coregraphics/cgrectunion(_:_:).md)
