<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOutlineViewDelegate/selectionShouldChange(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSOutlineViewDelegate(im)selectionShouldChangeInOutlineView:"
  },
  "title" : "selectionShouldChange(in:)"
}
-->

# selectionShouldChange(in:)

Returns a Boolean value that indicates whether the outline view should change its selection.

```
@MainActor optional func selectionShouldChange(in outlineView: NSOutlineView) -> Bool
```

## Parameters

`outlineView`

The outline view that sent the message.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> to permit `outlineView` to change its selection (typically a row being edited), <doc://com.apple.documentation/documentation/Swift/false> to deny permission.

## Discussion

For example, if the user is editing a cell and enters an improper value, the delegate can prevent the user from selecting or editing any other cells until a proper value has been entered into the original cell. The delegate can implement this method for complex validation of edited rows based on the values of any of their cells.

---

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)