<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMouseInRect(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSMouseInRect"
  },
  "title" : "NSMouseInRect(_:_:_:)"
}
-->

# NSMouseInRect(_:_:_:)

Returns a Boolean value that indicates whether the point is in the specified rectangle.

```
func NSMouseInRect(_ aPoint: NSPoint, _ aRect: NSRect, _ flipped: Bool) -> Bool
```

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the hot spot of the cursor lies inside a given rectangle, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method assumes an unscaled and unrotated coordinate system. Specify <doc://com.apple.documentation/documentation/Swift/true> for `flipped` if the underlying view uses a flipped coordinate system.

Point-in-rectangle functions generally assume that the bottom edge of a rectangle is outside of the rectangle boundaries, while the upper edge is inside the boundaries. This method views `aRect` from the point of view of the user—that is, this method always treats the bottom edge of the rectangle as the one closest to the bottom edge of the user’s screen. By making this adjustment, this function ensures consistent mouse-detection behavior from the user’s perspective.

---

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)