---
title: "NSPointInRect(_:_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nspointinrect(_:_:)"
---

# NSPointInRect(_:_:)

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

## Declaration

```swift
func NSPointInRect(_ aPoint: NSPoint, _ aRect: NSRect) -> Bool
```

## Return Value

Return Value true if aPoint is located within the rectangle represented by aRect, otherwise false.

## Discussion

Discussion Point-in-rectangle functions generally assume that the “upper” and “left” edges of a rectangle are inside  the rectangle boundaries, while the “lower” and “right” edges are outside the boundaries. This method treats the “upper” and “left” edges of the rectangle as the ones containing the origin of the rectangle. Special Considerations The meanings of “upper” and “lower” (and “left” and “right”) are relative to the current coordinate system and the location of the rectangle. For a rectangle of positive height located in positive x and y coordinates: In the default macOS desktop coordinate system—where the origin is at the bottom left—the rectangle edge closest to the bottom of the screen is the “upper” edge (and is considered inside the rectangle). On iOS and in a flipped coordinate system in macOS desktop—where the origin is at the top left—the rectangle edge closest to the bottom of the screen is the “lower” edge (and is considered outside the rectangle).

## See Also

### Managing Rectangles

- [NSContainsRect(_:_:)](foundation/nscontainsrect(_:_:).md)
- [NSDivideRect(_:_:_:_:_:)](foundation/nsdividerect(_:_:_:_:_:).md)
- [NSEqualRects(_:_:)](foundation/nsequalrects(_:_:).md)
- [NSIsEmptyRect(_:)](foundation/nsisemptyrect(_:).md)
- [NSHeight(_:)](foundation/nsheight(_:).md)
- [NSInsetRect(_:_:_:)](foundation/nsinsetrect(_:_:_:).md)
- [NSIntegralRect(_:)](foundation/nsintegralrect(_:).md)
- [NSIntegralRectWithOptions(_:_:)](foundation/nsintegralrectwithoptions(_:_:).md)
- [NSIntersectionRect(_:_:)](foundation/nsintersectionrect(_:_:).md)
- [NSIntersectsRect(_:_:)](foundation/nsintersectsrect(_:_:).md)
- [NSMakeRect(_:_:_:_:)](foundation/nsmakerect(_:_:_:_:).md)
- [NSMaxX(_:)](foundation/nsmaxx(_:).md)
- [NSMaxY(_:)](foundation/nsmaxy(_:).md)
- [NSMidX(_:)](foundation/nsmidx(_:).md)
- [NSMidY(_:)](foundation/nsmidy(_:).md)
