<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSplitViewDelegate/splitView(_:constrainSplitPosition:ofSubviewAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSplitViewDelegate(im)splitView:constrainSplitPosition:ofSubviewAt:"
  },
  "title" : "splitView(_:constrainSplitPosition:ofSubviewAt:)"
}
-->

# splitView(_:constrainSplitPosition:ofSubviewAt:)

Allows the delegate to constrain the divider to certain positions.

```
@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

The position for constraining the divider.

## 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`.

---

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)