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

# rect(for:)

Returns the rectangle occupied by `aPart`, which for this method is interpreted literally rather than as an indicator of scrolling direction.

```
func rect(for partCode: NSScroller.Part) -> NSRect
```

## Discussion

See [`NSScroller.Part`](/documentation/AppKit/NSScroller/Part) for a list of possible values for `aPart`.

Note the interpretations of `NSScrollerDecrementPage` and `NSScrollerIncrementPage`. The actual part of an NSScroller that causes page-by-page scrolling varies, so as a convenience these part codes refer to useful parts different from the scroll buttons.

Returns `NSZeroRect` if the part requested isn’t present on the receiver.

## See Also

[`hitPart`](/documentation/AppKit/NSScroller/hitPart)

A part code indicating the manner in which the scrolling should be performed.



---

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)