---
title: "rect(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsscroller/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.

## Declaration

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

## Discussion

Discussion See 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

### Related Documentation

- [hitPart](appkit/nsscroller/hitpart.md)

### Calculating Layout

- [testPart(_:)](appkit/nsscroller/testpart(_:).md)
- [checkSpaceForParts()](appkit/nsscroller/checkspaceforparts().md)
- [usableParts](appkit/nsscroller/usableparts-swift.property.md)
