---
title: "selectionShouldChange(in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsoutlineviewdelegate/selectionshouldchange(in:)"
---

# selectionShouldChange(in:)

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

## Declaration

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

## Parameters

- `outlineView`: The outline view that sent the message.

## Return Value

Return Value true to permit outlineView to change its selection (typically a row being edited), false to deny permission.

## Discussion

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.

## See Also

### Handling Selection

- [outlineView(_:shouldSelect:)](appkit/nsoutlineviewdelegate/outlineview(_:shouldselect:).md)
- [outlineView(_:shouldSelectItem:)](appkit/nsoutlineviewdelegate/outlineview(_:shouldselectitem:).md)
- [outlineView(_:selectionIndexesForProposedSelection:)](appkit/nsoutlineviewdelegate/outlineview(_:selectionindexesforproposedselection:).md)
- [outlineViewSelectionIsChanging(_:)](appkit/nsoutlineviewdelegate/outlineviewselectionischanging(_:).md)
- [outlineViewSelectionDidChange(_:)](appkit/nsoutlineviewdelegate/outlineviewselectiondidchange(_:).md)
