<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGRectContainsPoint(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGRectContainsPoint"
  },
  "title" : "CGRectContainsPoint(_:_:)"
}
-->

# CGRectContainsPoint(_:_:)

Returns whether a rectangle contains a specified point.

```
func CGRectContainsPoint(_ rect: CGRect, _ point: CGPoint) -> Bool
```

## Parameters

`rect`

The rectangle to examine.

`point`

The point to examine.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the rectangle is not null or empty and the point is located within the rectangle; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

A point is considered inside the rectangle if its coordinates lie inside the rectangle or on the minimum X or minimum Y edge.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)