<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSearchFieldCell/searchTextRect(forBounds:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSearchFieldCell(im)searchTextRectForBounds:"
  },
  "title" : "searchTextRect(forBounds:)"
}
-->

# searchTextRect(forBounds:)

Modifies the bounding rectangle for the search-text field cell.

```
func searchTextRect(forBounds rect: NSRect) -> NSRect
```

## Parameters

`rect`

The current bounding rectangle for the search text field.

## Return Value

The updated bounding rectangle to use for the search text field. The default value is the value passed into the `rect` parameter.

## Discussion

Subclasses can override this method to return a new bounding rectangle for the text-field cell object. You might use this method to provide a custom layout for the search field control.

---

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)