---
title: preservesSelection
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nstreecontroller/preservesselection
---

# preservesSelection

A Boolean value that indicates whether the tree controller will attempt to preserve the current selection when the content changes.

## Declaration

```swift
var preservesSelection: Bool { get set }
```

## Discussion

Discussion When the value of this property is true, the selection is preserved, if possible. The default value is true. This property is observable using key-value observing.

## See Also

### Managing Selections

- [selectsInsertedObjects](appkit/nstreecontroller/selectsinsertedobjects.md)
- [addSelectionIndexPaths(_:)](appkit/nstreecontroller/addselectionindexpaths(_:).md)
- [removeSelectionIndexPaths(_:)](appkit/nstreecontroller/removeselectionindexpaths(_:).md)
- [avoidsEmptySelection](appkit/nstreecontroller/avoidsemptyselection.md)
- [alwaysUsesMultipleValuesMarker](appkit/nstreecontroller/alwaysusesmultiplevaluesmarker.md)
