---
title: "contains(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextcontainer/contains(_:)"
---

# contains(_:)

Queries whether a point lies within the text container’s region or on the region’s edge—not simply within its bounding rectangle.

## Declaration

```swift
func contains(_ point: NSPoint) -> Bool
```

## Parameters

- `point`: The point in question.

## Return Value

Return Value true if aPoint lies within the receiver’s region or on the region’s edge—not simply within its bounding rectangle—false otherwise.

## Discussion

Discussion For example, if the receiver defines a donut shape and aPoint lies in the hole, this method returns false. This method can be used for hit testing of mouse events. The default NSTextContainer implementation merely checks that aPoint lies within its bounding rectangle.

## See Also

### Deprecated

- [init(containerSize:)](appkit/nstextcontainer/init(containersize:).md)
- [lineFragmentRect(forProposedRect:sweepDirection:movementDirection:remaining:)](appkit/nstextcontainer/linefragmentrect(forproposedrect:sweepdirection:movementdirection:remaining:).md)
- [containerSize](appkit/nstextcontainer/containersize.md)
