---
title: "splitView(_:constrainSplitPosition:ofSubviewAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssplitviewdelegate/splitview(_:constrainsplitposition:ofsubviewat:)"
---

# splitView(_:constrainSplitPosition:ofSubviewAt:)

Allows the delegate to constrain the divider to certain positions.

## Declaration

```swift
@MainActor optional func splitView(_ splitView: NSSplitView, constrainSplitPosition proposedPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat
```

## Parameters

- `splitView`: The split view that sends the message.
- `proposedPosition`: The cursor’s current position, and the proposed position of the divider.
- `dividerIndex`: The index of the divider the user is moving, with the first divider being 0 and increasing from top to bottom (or left to right).

## Return Value

Return Value The position for constraining the divider.

## Discussion

Discussion If the delegate implements this method, the split view calls it repeatedly as the user moves the divider. If a subview’s height must be a multiple of a certain number, use this method to return the multiple nearest to proposedPosition.
