<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSplitView/setHoldingPriority(_:forSubviewAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSplitView(im)setHoldingPriority:forSubviewAtIndex:"
  },
  "title" : "setHoldingPriority(_:forSubviewAt:)"
}
-->

# setHoldingPriority(_:forSubviewAt:)

Sets the priority for split view subviews to maintain their width or height.

```
func setHoldingPriority(_ priority: NSLayoutConstraint.Priority, forSubviewAt subviewIndex: Int)
```

## Parameters

`priority`

The priority.

`subviewIndex`

The index of the subview

## Discussion

Calling this method sets the priority that split view subviews use to maintain their width (for a vertical split view) or height (for a horizontal split view). During a split view resize, subviews with higher priorities maintain their sizes before subviews with lower priorities. The subview with the lowest priority is the first to gain additional thickness if the split view grows or shrinks.

The default priority is [`defaultLow`](/documentation/AppKit/NSLayoutConstraint/Priority-swift.struct/defaultLow). Use priorities less than [`dragThatCannotResizeWindow`](/documentation/AppKit/NSLayoutConstraint/Priority-swift.struct/dragThatCannotResizeWindow).

---

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)