---
title: "CGRectEqualToRect(_:_:)"
framework: coregraphics
role: symbol
role_heading: Function
path: "coregraphics/cgrectequaltorect(_:_:)"
---

# CGRectEqualToRect(_:_:)

Returns whether two rectangles are equal in size and position.

## Declaration

```swift
func CGRectEqualToRect(_ rect1: CGRect, _ rect2: CGRect) -> Bool
```

## Parameters

- `rect1`: The first rectangle to examine.
- `rect2`: The second rectangle to examine.

## Return Value

Return Value true if the two specified rectangles have equal size and origin values, or if both rectangles are null rectangles. Otherwise, false.

## See Also

### Comparing Values

- [CGRectIntersectsRect(_:_:)](coregraphics/cgrectintersectsrect(_:_:).md)
