---
title: "setSelectionIndexes(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsarraycontroller/setselectionindexes(_:)"
---

# setSelectionIndexes(_:)

Sets the receiver’s selection indexes and returns a Boolean value that indicates whether the selection changed.

## Declaration

```swift
func setSelectionIndexes(_ indexes: IndexSet) -> Bool
```

## Parameters

- `indexes`: The set of selection indexes for the receiver.

## Return Value

Return Value true if the selection was changed, otherwise false.

## Discussion

Discussion Attempting to change the selection may cause a commitEditing() message which fails, thus denying the selection change. To select all the receiver’s objects, indexes should be an index set with indexes [0...count -1]. To deselect all indexes, pass an empty index set.

## See Also

### Managing selections

- [selectionIndex](appkit/nsarraycontroller/selectionindex.md)
- [setSelectionIndex(_:)](appkit/nsarraycontroller/setselectionindex(_:).md)
- [selectsInsertedObjects](appkit/nsarraycontroller/selectsinsertedobjects.md)
- [selectionIndexes](appkit/nsarraycontroller/selectionindexes.md)
- [addSelectionIndexes(_:)](appkit/nsarraycontroller/addselectionindexes(_:).md)
- [removeSelectionIndexes(_:)](appkit/nsarraycontroller/removeselectionindexes(_:).md)
- [setSelectedObjects(_:)](appkit/nsarraycontroller/setselectedobjects(_:).md)
- [selectedObjects](appkit/nsarraycontroller/selectedobjects.md)
- [addSelectedObjects(_:)](appkit/nsarraycontroller/addselectedobjects(_:).md)
- [removeSelectedObjects(_:)](appkit/nsarraycontroller/removeselectedobjects(_:).md)
- [selectNext(_:)](appkit/nsarraycontroller/selectnext(_:).md)
- [canSelectNext](appkit/nsarraycontroller/canselectnext.md)
- [selectPrevious(_:)](appkit/nsarraycontroller/selectprevious(_:).md)
- [canSelectPrevious](appkit/nsarraycontroller/canselectprevious.md)
